qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] tests: test-announce-self: fix memory leak
@ 2019-03-10 13:12 Li Qiang
  2019-03-11  8:29 ` Thomas Huth
  0 siblings, 1 reply; 2+ messages in thread
From: Li Qiang @ 2019-03-10 13:12 UTC (permalink / raw)
  To: vyasevic, dgilbert, mst, jasowang; +Cc: qemu-devel, liq3ea, Li Qiang

Spotted by ASAN when 'make check'.

Signed-off-by: Li Qiang <liq3ea@163.com>
---
 tests/test-announce-self.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/tests/test-announce-self.c b/tests/test-announce-self.c
index 1644d34a3f..3f370d8bf5 100644
--- a/tests/test-announce-self.c
+++ b/tests/test-announce-self.c
@@ -21,17 +21,6 @@
 #define ETH_P_RARP 0x8035
 #endif
 
-static QTestState *test_init(int socket)
-{
-    char *args;
-
-    args = g_strdup_printf("-netdev socket,fd=%d,id=hs0 -device "
-                           "virtio-net-pci,netdev=hs0", socket);
-
-    return qtest_start(args);
-}
-
-
 static void test_announce(int socket)
 {
     char buffer[60];
@@ -58,19 +47,22 @@ static void test_announce(int socket)
 
 static void setup(gconstpointer data)
 {
-    QTestState *qs;
     void (*func) (int socket) = data;
     int sv[2], ret;
+    char *args;
 
     ret = socketpair(PF_UNIX, SOCK_STREAM, 0, sv);
     g_assert_cmpint(ret, !=, -1);
 
-    qs = test_init(sv[1]);
+    args = g_strdup_printf("-netdev socket,fd=%d,id=hs0 -device "
+                           "virtio-net-pci,netdev=hs0", sv[1]);
+    qtest_start(args);
     func(sv[0]);
 
     /* End test */
     close(sv[0]);
-    qtest_quit(qs);
+    qtest_end();
+    g_free(args);
 }
 
 int main(int argc, char **argv)
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-11  8:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-10 13:12 [Qemu-devel] [PATCH] tests: test-announce-self: fix memory leak Li Qiang
2019-03-11  8:29 ` Thomas Huth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).