[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V2] vhost-user-test: fix a memory leak
From: |
pannengyuan |
Subject: |
[PATCH V2] vhost-user-test: fix a memory leak |
Date: |
Fri, 20 Dec 2019 09:26:54 +0800 |
From: Pan Nengyuan <address@hidden>
Spotted by ASAN.
Reported-by: Euler Robot <address@hidden>
Signed-off-by: Pan Nengyuan <address@hidden>
---
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH V2] vhost-user-test: fix a memory leak,
pannengyuan <=