]> xenbits.xensource.com Git - libvirt.git/commit
testUpdateQEMUCaps: Don't leak host cpuData
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 31 May 2018 10:00:41 +0000 (12:00 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 31 May 2018 13:20:57 +0000 (15:20 +0200)
commit5276ec712a44b3680569a096e8fe56a925f0d495
tree1ab8106d8c448a1f270f45f46e740b05a2314f0f
parentcc9c75f562f2cb69d374f5fc742e22b423ba6099
testUpdateQEMUCaps: Don't leak host cpuData

When preparing qemuCaps for test cases the following is
happening:

qemuTestParseCapabilitiesArch() is called, which calls
virQEMUCapsLoadCache() which in turn calls
virQEMUCapsInitHostCPUModel() which sets qemuCaps->kvmCPU and
qemuCaps->tcgCPU.

But then the code tries to update the capabilities:

testCompareXMLToArgv() calls testUpdateQEMUCaps() which calls
virQEMUCapsInitHostCPUModel() again overwriting previously
allocated memory. The solution is to free host cpuData in
testUpdateQEMUCaps().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_capabilities.c
src/qemu/qemu_capspriv.h
tests/qemuxml2argvtest.c