Fix crash in device hotplug cleanup code

* src/qemu/qemu_driver.c: Fix crash in scenario where XML
  parsing of hotplugged device failed & thus 'dev' is NULL
This commit is contained in:
Daniel P. Berrange 2009-09-24 15:42:25 +01:00
parent 46da355022
commit 879cd8cc2b

View File

@ -4880,7 +4880,7 @@ cleanup:
if (cgroup)
virCgroupFree(&cgroup);
if (ret < 0) {
if (ret < 0 && dev != NULL) {
if (qemuDomainSetDeviceOwnership(dom->conn, driver, dev, 1) < 0)
VIR_WARN0("Fail to restore disk device ownership");
virDomainDeviceDefFree(dev);