]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: qemuhotplug: Fix segfault when XML loading fails
authorCole Robinson <crobinso@redhat.com>
Thu, 29 Jun 2017 13:20:54 +0000 (09:20 -0400)
committerCole Robinson <crobinso@redhat.com>
Thu, 26 Jul 2018 14:13:00 +0000 (10:13 -0400)
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

Acked-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
tests/qemuhotplugtest.c

index 674ba92b27387a8dba87275072208a0c2bce462a..3c0eecb07967ad312784a06f5b9f063c78816deb 100644 (file)
@@ -268,6 +268,10 @@ testQemuHotplug(const void *data)
 
     if (test->vm) {
         vm = test->vm;
+        if (!vm->def) {
+            VIR_TEST_VERBOSE("test skipped due to failure of dependent test\n");
+            goto cleanup;
+        }
     } else {
         if (qemuHotplugCreateObjects(driver.xmlopt, &vm, domain_xml,
                                      test->deviceDeletedEvent) < 0)