qemu: Fix double free when live-attaching shmem

Function qemuDomainAttachShmemDevice() steals the device data if the
hotplug was successful, but the condition checked for unsuccessful
execution otherwise.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2016-11-09 17:40:17 +01:00
parent e66603539b
commit cca34e38fd

View File

@ -7615,7 +7615,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm,
case VIR_DOMAIN_DEVICE_SHMEM:
ret = qemuDomainAttachShmemDevice(driver, vm,
dev->data.shmem);
if (ret < 0) {
if (!ret) {
alias = dev->data.shmem->info.alias;
dev->data.shmem = NULL;
}