From: Pan Nengyuan <pannengy...@huawei.com> Spotted by ASAN.
Reported-by: Euler Robot <euler.ro...@huawei.com> Signed-off-by: Pan Nengyuan <pannengy...@huawei.com> --- Changes V2 to V1: - use a "goto cleanup", instead of duplicating the "free" functions. - free "dest_cmdline" at the end. --- tests/vhost-user-test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 91ea373..dcb8617 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -717,7 +717,7 @@ static void test_migrate(void *obj, void *arg, QGuestAllocator *alloc) guint64 size; if (!wait_for_fds(s)) { - return; + goto cleanup; } size = get_log_size(s); @@ -776,8 +776,11 @@ static void test_migrate(void *obj, void *arg, QGuestAllocator *alloc) g_source_unref(source); qtest_quit(to); + + cleanup: test_server_free(dest); g_free(uri); + g_string_free(dest_cmdline, true); } static void wait_for_rings_started(TestServer *s, size_t count) -- 2.7.2.windows.1