[PATCH 2/5] qemuDomainChrRemove: Don't leak vmdef->consoles[0]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When removing the compat console from domain defintion, removing
it from the vmdef->consoles array is good, but not sufficient.
The console definition might have been fully allocated (after
daemon restarted and reloaded the status XML). Use
virDomainChrDefFree() to free also the definition.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_hotplug.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index f517646c55..a6407f074b 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1937,8 +1937,10 @@ qemuDomainChrRemove(virDomainDef *vmdef,
             return NULL;
     }
 
-    if (removeCompat)
+    if (removeCompat) {
+        virDomainChrDefFree(vmdef->consoles[0]);
         VIR_DELETE_ELEMENT(vmdef->consoles, 0, vmdef->nconsoles);
+    }
 
     return ret;
 }
-- 
2.39.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux