From 14324f585d76abd8a609c119d627503e6a0961be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 27 Jan 2017 12:10:21 +0400 Subject: [PATCH] tests: fix leaks in test-io-channel-command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No need for strdup, fix leaks when socat is missing. Spotted by ASAN. Signed-off-by: Marc-André Lureau Reviewed-by: "Daniel P. Berrange" Reviewed-by: Greg Kurz --- tests/test-io-channel-command.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/test-io-channel-command.c b/tests/test-io-channel-command.c index 1d1f461bed..46ce1ff01c 100644 --- a/tests/test-io-channel-command.c +++ b/tests/test-io-channel-command.c @@ -29,8 +29,8 @@ static void test_io_channel_command_fifo(bool async) #define TEST_FIFO "tests/test-io-channel-command.fifo" QIOChannel *src, *dst; QIOChannelTest *test; - char *srcfifo = g_strdup_printf("PIPE:%s,wronly", TEST_FIFO); - char *dstfifo = g_strdup_printf("PIPE:%s,rdonly", TEST_FIFO); + const char *srcfifo = "PIPE:" TEST_FIFO ",wronly"; + const char *dstfifo = "PIPE:" TEST_FIFO ",rdonly"; const char *srcargv[] = { "/bin/socat", "-", srcfifo, NULL, }; @@ -59,8 +59,6 @@ static void test_io_channel_command_fifo(bool async) object_unref(OBJECT(src)); object_unref(OBJECT(dst)); - g_free(srcfifo); - g_free(dstfifo); unlink(TEST_FIFO); }