From edc6e5015da4d215aaa09bb93060f8cf090cccff Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 12 Mar 2019 14:06:04 +0100 Subject: [PATCH 1/4] test-char: fix undefined behavior Fixes the following failure with --enable-debug: /tmp/qemu-test/src/tests/test-char.c:838:10: runtime error: load of value 40, which is not a valid value for type bool SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /tmp/qemu-test/src/tests/test-char.c:838:10 in Signed-off-by: Paolo Bonzini --- tests/test-char.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-char.c b/tests/test-char.c index de328380c1..95ccfd3cdb 100644 --- a/tests/test-char.c +++ b/tests/test-char.c @@ -745,7 +745,7 @@ static void char_socket_server_test(gconstpointer opaque) Visitor *v; QemuThread thread; int ret; - bool reconnected; + bool reconnected = false; char *optstr; QemuOpts *opts; From 1afee8c3da14bd2daf60f98c940ac60cfab9d8b5 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 12 Mar 2019 14:07:25 +0100 Subject: [PATCH 2/4] test-bdrv-graph-mod: fix Error leak Signed-off-by: Paolo Bonzini --- tests/test-bdrv-graph-mod.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test-bdrv-graph-mod.c b/tests/test-bdrv-graph-mod.c index 458dfa6661..283dc84869 100644 --- a/tests/test-bdrv-graph-mod.c +++ b/tests/test-bdrv-graph-mod.c @@ -114,6 +114,7 @@ static void test_update_perm_tree(void) bdrv_append(filter, bs, &local_err); g_assert_nonnull(local_err); + error_free(local_err); bdrv_unref(bs); blk_unref(root); From 5e78bc6a47dd064c63fbf03d01ec4a3c811157e9 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 12 Mar 2019 14:50:50 +0100 Subject: [PATCH 3/4] migration: fix memory leak Reported by ASAN. Signed-off-by: Paolo Bonzini --- migration/socket.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/socket.c b/migration/socket.c index 239527fb1f..49bacf78fd 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -199,6 +199,7 @@ static void socket_start_incoming_migration(SocketAddress *saddr, return; } migrate_add_address(address); + qapi_free_SocketAddress(address); } } From 1e25879e6f832373775492c11c648ab2fff69bd5 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 12 Mar 2019 15:07:22 +0100 Subject: [PATCH 4/4] test-migration: fix memory leak Reported by ASAN. Signed-off-by: Paolo Bonzini --- tests/migration-test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index 48dc20a2ae..bd3f5c3125 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -382,9 +382,10 @@ static char *migrate_get_socket_address(QTestState *who, const char *parameter) iv = qobject_input_visitor_new(object); visit_type_SocketAddressList(iv, NULL, &addrs, &local_err); + visit_free(iv); /* we are only using a single address */ - result = g_strdup_printf("%s", SocketAddress_to_str(addrs->value)); + result = SocketAddress_to_str(addrs->value); qapi_free_SocketAddressList(addrs); qobject_unref(rsp);