[libvirt] [PATCH 3/7] tests: qemuhotplug: Fix segfault when XML loading fails

Cole Robinson crobinso at redhat.com
Tue Jul 24 21:23:44 UTC 2018


Some tests use the same VM state multiple times in a row. But if we
failed loading the VM XML, subsequent tests crash on the NULL def
pointer

Signed-off-by: Cole Robinson <crobinso at redhat.com>
---
I hit this with failing tests while writing this series

 tests/qemuhotplugtest.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 674ba92b27..4f9e127f88 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -268,6 +268,8 @@ testQemuHotplug(const void *data)
 
     if (test->vm) {
         vm = test->vm;
+        if (!vm->def)
+            goto cleanup;
     } else {
         if (qemuHotplugCreateObjects(driver.xmlopt, &vm, domain_xml,
                                      test->deviceDeletedEvent) < 0)
-- 
2.17.1




More information about the libvir-list mailing list