From: Marc-André Lureau <marcandre.lureau@redhat.com> Date: Tue, 6 Jun 2017 20:45:43 +0000 (+0400) Subject: test-iov: replace g_malloc()+memcpy() with g_memdup() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=38cc1dba1fd3a906ecf8384f592b2d4952b0e43c;p=qemu.git 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> --- diff --git a/tests/test-iov.c b/tests/test-iov.c index a22d71fd2c..fa3d75aee1 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");