From: Cole Robinson Date: Thu, 29 Jun 2017 13:20:54 +0000 (-0400) Subject: tests: qemuhotplug: Fix segfault when XML loading fails X-Git-Tag: v4.6.0-rc1~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f14f0836c5e2f2df6d48495c0c0893c64b026b31;p=thirdparty%2Flibvirt.git tests: qemuhotplug: Fix segfault when XML loading fails 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 Signed-off-by: Cole Robinson --- diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 674ba92b27..3c0eecb079 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -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)