On Mon, Oct 24, 2016 at 17:55:06 +0200, Ján Tomko wrote:
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.
Well, hostCPUModel is not stored in the cache; it's (going to be)
computed from other fields in the cache so it will still be NULL after
reading caps cache.
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;
}
But it still makes sense to free it here. ACK.
Jirka