OSDN Git Service

tests/ide: Free pcibus when finishing a test
authorThomas Huth <thuth@redhat.com>
Tue, 13 Nov 2018 15:03:21 +0000 (16:03 +0100)
committerThomas Huth <thuth@redhat.com>
Mon, 19 Nov 2018 20:59:44 +0000 (21:59 +0100)
Once a test has finished, the pcibus structure should be freed, to
avoid leaking memory and to make sure that the structure is properly
re-initialized when the next test starts.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/ide-test.c

index 33cef61..f0280e6 100644 (file)
@@ -142,6 +142,10 @@ static void ide_test_start(const char *cmdline_fmt, ...)
 
 static void ide_test_quit(void)
 {
+    if (pcibus) {
+        qpci_free_pc(pcibus);
+        pcibus = NULL;
+    }
     pc_alloc_uninit(guest_malloc);
     guest_malloc = NULL;
     qtest_end();