]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: fix memleak in qemuDomainAttachDeviceLive()
authorJin Yan <jinyan12@huawei.com>
Mon, 13 Jul 2020 19:24:04 +0000 (21:24 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 13 Jul 2020 20:00:49 +0000 (22:00 +0200)
During disk hot plugging, qemuDomainAttachDeviceLive() adds the new
disk to the device list of the VM object. However, hot plugging
cdroms and floppies only updates the src variable of the original
disk device, so the newly generated disk object needs to be freed.

Signed-off-by: Jin Yan <jinyan12@huawei.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_hotplug.c

index e897c059ddbc355525700de46f2c53386dabf6a2..7c308d02aaed769d56c31c57c30564403dd11bb7 100644 (file)
@@ -1115,6 +1115,7 @@ qemuDomainAttachDeviceDiskLive(virQEMUDriverPtr driver,
             return -1;
 
         disk->src = NULL;
+        virDomainDiskDefFree(disk);
         return 0;
     }