aboutsummaryrefslogtreecommitdiff
path: root/tests/test-iov.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-06-07 00:45:43 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2017-08-31 12:29:07 +0200
commit38cc1dba1fd3a906ecf8384f592b2d4952b0e43c (patch)
tree427de1fdadfb897f052141efd7f1a476f4c40e21 /tests/test-iov.c
parentad2c19937e0b80f8037e411f72e6d6078fe673ca (diff)
downloadqemu-38cc1dba1fd3a906ecf8384f592b2d4952b0e43c.zip
qemu-38cc1dba1fd3a906ecf8384f592b2d4952b0e43c.tar.gz
qemu-38cc1dba1fd3a906ecf8384f592b2d4952b0e43c.tar.bz2
test-iov: replace g_malloc()+memcpy() with g_memdup()
I found these pattern via grepping the source tree. I don't have a coccinelle script for it! Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'tests/test-iov.c')
-rw-r--r--tests/test-iov.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/tests/test-iov.c b/tests/test-iov.c
index a22d71f..fa3d75a 100644
--- a/tests/test-iov.c
+++ b/tests/test-iov.c
@@ -167,8 +167,7 @@ static void test_io(void)
}
iov_from_buf(iov, niov, 0, buf, sz);
- siov = g_malloc(sizeof(*iov) * niov);
- memcpy(siov, iov, sizeof(*iov) * niov);
+ siov = g_memdup(iov, sizeof(*iov) * niov);
if (socketpair(PF_UNIX, SOCK_STREAM, 0, sv) < 0) {
perror("socketpair");