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 <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2017-06-29 09:20:54 -04:00
parent 8e2982b576
commit f14f0836c5

View 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)