From f14f0836c5e2f2df6d48495c0c0893c64b026b31 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Thu, 29 Jun 2017 09:20:54 -0400 Subject: [PATCH] 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 --- tests/qemuhotplugtest.c | 4 ++++ 1 file changed, 4 insertions(+) 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) -- 2.47.2