From: Jin Yan Date: Mon, 13 Jul 2020 19:24:04 +0000 (+0200) Subject: qemu: fix memleak in qemuDomainAttachDeviceLive() X-Git-Tag: v6.6.0-rc1~122 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2f470a4fb1edbe2da702e398314b9db201bb991e;p=thirdparty%2Flibvirt.git qemu: fix memleak in qemuDomainAttachDeviceLive() 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 Signed-off-by: Michal Privoznik Reviewed-by: Michal Privoznik --- diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index e897c059dd..7c308d02aa 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1115,6 +1115,7 @@ qemuDomainAttachDeviceDiskLive(virQEMUDriverPtr driver, return -1; disk->src = NULL; + virDomainDiskDefFree(disk); return 0; }