From 13ee9e30c8855a8b8d62b05992cfc65fc57a8df5 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Fri, 1 Mar 2019 16:10:18 +0100 Subject: tests: Do not use "\n" in g_test_message() strings g_test_message() takes care of the newline on its own, so we should not use \n in the strings here. Reviewed-by: Stefan Hajnoczi Signed-off-by: Thomas Huth --- tests/vhost-user-test.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tests/vhost-user-test.c') diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 4cd0a97f13..83ea15f37e 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -337,7 +337,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) } if (size != VHOST_USER_HDR_SIZE) { - g_test_message("Wrong message size received %d\n", size); + g_test_message("Wrong message size received %d", size); return; } @@ -348,7 +348,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) p += VHOST_USER_HDR_SIZE; size = qemu_chr_fe_read_all(chr, p, msg.size); if (size != msg.size) { - g_test_message("Wrong message size received %d != %d\n", + g_test_message("Wrong message size received %d != %d", size, msg.size); return; } @@ -476,7 +476,7 @@ static const char *init_hugepagefs(void) } if (access(path, R_OK | W_OK | X_OK)) { - g_test_message("access on path (%s): %s\n", path, strerror(errno)); + g_test_message("access on path (%s): %s", path, strerror(errno)); abort(); return NULL; } @@ -486,13 +486,13 @@ static const char *init_hugepagefs(void) } while (ret != 0 && errno == EINTR); if (ret != 0) { - g_test_message("statfs on path (%s): %s\n", path, strerror(errno)); + g_test_message("statfs on path (%s): %s", path, strerror(errno)); abort(); return NULL; } if (fs.f_type != HUGETLBFS_MAGIC) { - g_test_message("Warning: path not on HugeTLBFS: %s\n", path); + g_test_message("Warning: path not on HugeTLBFS: %s", path); abort(); return NULL; } -- cgit v1.2.3-55-g7522 From 5411f3d0a25fc15cc0d42d985e5fdeddd51c0606 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Tue, 5 Mar 2019 23:51:35 +0100 Subject: vhost-user-test: fix leaks Spotted by ASAN. Signed-off-by: Marc-André Lureau Reviewed-by: Thomas Huth Reviewed-by: Michael S. Tsirkin Reviewed-by: Stefano Garzarella Fixes: ae31fb54914 and 4d3f50eb489 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Thomas Huth --- tests/vhost-user-test.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/vhost-user-test.c') diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 83ea15f37e..14a1e2fbac 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -588,6 +588,7 @@ static void test_server_free(TestServer *server) g_test_message("unable to rmdir: path (%s): %s", server->tmpfs, strerror(errno)); } + g_free(server->tmpfs); qemu_chr_fe_deinit(&server->chr, true); @@ -605,6 +606,8 @@ static void test_server_free(TestServer *server) g_main_loop_unref(server->loop); g_main_context_unref(server->context); + g_cond_clear(&server->data_cond); + g_mutex_clear(&server->data_mutex); g_free(server); } -- cgit v1.2.3-55-g7522