From e46e168f9767b8b291f23217fc7a62163c82eaf8 Mon Sep 17 00:00:00 2001
From: Jin Yan <jinya...@huawei.com>
Date: Tue, 7 Jul 2020 21:58:52 +0800
Subject: [PATCH] qemu: fix memleaks in qemuDomainAttachDeviceLive()

During disk hotplugging, qemuDomainAttachDeviceLive() add the new
disk to the device list of the VM object. However, hotplugging
cdroms and floppies only updates the src variable of the original
disk device, so the newly generated disk object needs to be released.

Signed-off-by: Jin Yan <jinya...@huawei.com>
---
 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 3954ad1109..40092b499d 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;
     }

--



Reply via email to