[libvirt] [PATCH] qemu: Fix double free when live-attaching shmem

Martin Kletzander mkletzan at redhat.com
Wed Nov 9 16:43:49 UTC 2016


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 at redhat.com>
---
 src/qemu/qemu_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 38c841420e32..a82e58b29f29 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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;
         }
-- 
2.10.2




More information about the libvir-list mailing list