From: Daniel P. Berrange Date: Thu, 24 Sep 2009 14:42:25 +0000 (+0100) Subject: Fix crash in device hotplug cleanup code X-Git-Tag: v0.7.2~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=879cd8cc2ba00f795913f296556e05f25afa7877;p=thirdparty%2Flibvirt.git 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 --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index cf225c15ce..155e4a3015 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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);