[Qemu-devel] [PULL 4/4] test-migration: fix memory leak

Paolo Bonzini posted 4 patches 6 years, 11 months ago
Maintainers: "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Thomas Huth <thuth@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Juan Quintela <quintela@redhat.com>
[Qemu-devel] [PULL 4/4] test-migration: fix memory leak
Posted by Paolo Bonzini 6 years, 11 months ago
Reported by ASAN.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 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);
-- 
2.20.1