To keep freeing of host CPU data in one place. Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- src/qemu/qemu_capabilities.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 218fd50b2..6f0d6287e 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2142,6 +2142,21 @@ virQEMUCapsHostCPUDataCopy(virQEMUCapsPtr dst, } +static void +virQEMUCapsHostCPUDataClear(virQEMUCapsPtr qemuCaps) +{ + qemuMonitorCPUModelInfoFree(qemuCaps->kvmCPUModelInfo); + qemuMonitorCPUModelInfoFree(qemuCaps->tcgCPUModelInfo); + qemuCaps->kvmCPUModelInfo = NULL; + qemuCaps->tcgCPUModelInfo = NULL; + + virCPUDefFree(qemuCaps->kvmCPUModel); + virCPUDefFree(qemuCaps->tcgCPUModel); + qemuCaps->kvmCPUModel = NULL; + qemuCaps->tcgCPUModel = NULL; +} + + virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps) { virQEMUCapsPtr ret = virQEMUCapsNew(); @@ -2228,10 +2243,7 @@ void virQEMUCapsDispose(void *obj) VIR_FREE(qemuCaps->gicCapabilities); - qemuMonitorCPUModelInfoFree(qemuCaps->kvmCPUModelInfo); - qemuMonitorCPUModelInfoFree(qemuCaps->tcgCPUModelInfo); - virCPUDefFree(qemuCaps->kvmCPUModel); - virCPUDefFree(qemuCaps->tcgCPUModel); + virQEMUCapsHostCPUDataClear(qemuCaps); } void @@ -4109,15 +4121,7 @@ virQEMUCapsReset(virQEMUCapsPtr qemuCaps) VIR_FREE(qemuCaps->gicCapabilities); qemuCaps->ngicCapabilities = 0; - qemuMonitorCPUModelInfoFree(qemuCaps->kvmCPUModelInfo); - qemuMonitorCPUModelInfoFree(qemuCaps->tcgCPUModelInfo); - qemuCaps->kvmCPUModelInfo = NULL; - qemuCaps->tcgCPUModelInfo = NULL; - - virCPUDefFree(qemuCaps->kvmCPUModel); - virCPUDefFree(qemuCaps->tcgCPUModel); - qemuCaps->kvmCPUModel = NULL; - qemuCaps->tcgCPUModel = NULL; + virQEMUCapsHostCPUDataClear(qemuCaps); } -- 2.12.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list