diff mbox series

[PULL,2/3] tests/ide: Free pcibus when finishing a test

Message ID 1542711143-1946-3-git-send-email-thuth@redhat.com
State New
Headers show
Series None | expand

Commit Message

Thomas Huth Nov. 20, 2018, 10:52 a.m. UTC
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 | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/tests/ide-test.c b/tests/ide-test.c
index 33cef61..f0280e6 100644
--- a/tests/ide-test.c
+++ b/tests/ide-test.c
@@ -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();