]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuDomainChrRemove: Don't leak vmdef->consoles[0]
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 12 Apr 2023 12:14:30 +0000 (14:14 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 18 Apr 2023 14:02:35 +0000 (16:02 +0200)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_hotplug.c

index f517646c556b38375f135a1ab3da86ee474413d6..a6407f074b224ca6e271513a857f79ac0c57975a 100644 (file)
@@ -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;
 }