diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-01-27 12:10:21 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-03-01 00:09:28 +0400 |
commit | 14324f585d76abd8a609c119d627503e6a0961be (patch) | |
tree | a2435668f6206b7ceb80278f50c3cb499ca9bb23 | |
parent | dc491fead04a92a612df93b85b0ebf9dcc3f6684 (diff) | |
download | qemu-14324f585d76abd8a609c119d627503e6a0961be.zip qemu-14324f585d76abd8a609c119d627503e6a0961be.tar.gz qemu-14324f585d76abd8a609c119d627503e6a0961be.tar.bz2 |
tests: fix leaks in test-io-channel-command
No need for strdup, fix leaks when socat is missing.
Spotted by ASAN.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: "Daniel P. Berrange" <berrange@redhat.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
-rw-r--r-- | tests/test-io-channel-command.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/tests/test-io-channel-command.c b/tests/test-io-channel-command.c index 1d1f461..46ce1ff 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); } |