Skip to contentSkip to conversation

vhost-user-test: fix leaks

PATCH In review Marc-André Lureau 5 participants 5 messages Mar 5, 2019 – Mar 6, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost-user-test: fix leaks

Spotted by ASAN.

---
 tests/vhost-user-test.c | 3 +++
 1 file changed, 3 insertions(+)
tests/vhost-user-test.c +3 -0
index 4cd0a97f13..9364227ba4 100644
@@ -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);
 }
 
Signature · 1 line
2.21.0.4.g36eb1cb9cf
Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · Marc-André Lureau

Spotted by ASAN.

---
 tests/vhost-user-test.c | 3 +++
 1 file changed, 3 insertions(+)
tests/vhost-user-test.c +1 -0
index 4cd0a97f13..9364227ba4 100644
@@ -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);
 

tests/vhost-user-test.c static void test_server_free(TestServer *server) · line 612

Quoted 7 lines
tests/vhost-user-test.c +2 -0
@@ -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);
 }

... and queued to my qtest-next branch (unless Michael wants to take it through hist vhost tree instead).

Reviewed-by
#2 lore raw
Quoted 31 lines · Thomas Huth
Quoted 20 lines · Marc-André Lureau

Spotted by ASAN.

---
 tests/vhost-user-test.c | 3 +++
 1 file changed, 3 insertions(+)
tests/vhost-user-test.c +1 -0
index 4cd0a97f13..9364227ba4 100644
@@ -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);
 

tests/vhost-user-test.c static void test_server_free(TestServer *server) · line 612

Quoted 7 lines
tests/vhost-user-test.c +2 -0
@@ -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);
 }
Quoted 2 lines

... and queued to my qtest-next branch (unless Michael wants to take it through hist vhost tree instead).

No it's fine.

Reviewed-by on v1 1/1
#4 lore raw
In reply to Marc-André Lureau
Quoted 12 lines · Marc-André Lureau

Spotted by ASAN.

---
 tests/vhost-user-test.c | 3 +++
 1 file changed, 3 insertions(+)
tests/vhost-user-test.c +0 -0
index 4cd0a97f13..9364227ba4 100644

tests/vhost-user-test.c static void test_server_free(TestServer *server) · line 591

Quoted 4 lines
tests/vhost-user-test.c +1 -0
@@ -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);
Fixes ae31fb54914 and 4d3f50eb489
Quoted 13 lines
tests/vhost-user-test.c +2 -0
     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);
 }