]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Fix double free when live-attaching shmem
authorMartin Kletzander <mkletzan@redhat.com>
Wed, 9 Nov 2016 16:40:17 +0000 (17:40 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Wed, 9 Nov 2016 16:52:17 +0000 (17:52 +0100)
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>
src/qemu/qemu_driver.c

index 38c841420e325b6227b3bcd67a26a9b9560b487f..a82e58b29f293baad74df661ca55c9f45cfdebe2 100644 (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;
         }