From 2f470a4fb1edbe2da702e398314b9db201bb991e Mon Sep 17 00:00:00 2001 From: Jin Yan Date: Mon, 13 Jul 2020 21:24:04 +0200 Subject: [PATCH] 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 --- src/qemu/qemu_hotplug.c | 1 + 1 file changed, 1 insertion(+) 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; } -- 2.47.2