[libvirt] [PATCH] virQEMUCapsReset: also clear out hostCPUModel

Ján Tomko jtomko at redhat.com
Mon Oct 24 15:55:06 UTC 2016


After succesfully reading an outdated caps cache from disk,
calling virQEMUCapsReset did not properly clear out the host
CPU model. This lead to a memory leak when the host CPU model
pointer was overwritten later in virQEMUCapsNewForBinaryInternal.

Introduced by commit 68c70118.
---
 src/qemu/qemu_capabilities.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 9132469..130f1db 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3430,6 +3430,9 @@ virQEMUCapsReset(virQEMUCapsPtr qemuCaps)
 
     VIR_FREE(qemuCaps->gicCapabilities);
     qemuCaps->ngicCapabilities = 0;
+
+    virCPUDefFree(qemuCaps->hostCPUModel);
+    qemuCaps->hostCPUModel = NULL;
 }
 
 
-- 
2.7.3




More information about the libvir-list mailing list