qemu: Introduce virQEMUCapsHostCPUDataClear

To keep freeing of host CPU data in one place.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2017-04-07 17:43:59 +02:00
parent 8be4346ca5
commit b0605e8487

View File

@ -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);
}