提交 d0498881 编写于 作者: M Michal Privoznik

virQEMUCapsFreeHostCPUModel: Don't always free host cpuData

This function exists because of 5276ec71. But it is
missing initial check just like virQEMUCapsInitHostCPUModel()
has.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 a9884d70
...@@ -2848,10 +2848,14 @@ virQEMUCapsNewHostCPUModel(void) ...@@ -2848,10 +2848,14 @@ virQEMUCapsNewHostCPUModel(void)
void void
virQEMUCapsFreeHostCPUModel(virQEMUCapsPtr qemuCaps, virQEMUCapsFreeHostCPUModel(virQEMUCapsPtr qemuCaps,
virArch hostArch,
virDomainVirtType type) virDomainVirtType type)
{ {
virQEMUCapsHostCPUDataPtr cpuData = virQEMUCapsGetHostCPUData(qemuCaps, type); virQEMUCapsHostCPUDataPtr cpuData = virQEMUCapsGetHostCPUData(qemuCaps, type);
if (!virQEMUCapsGuestIsNative(hostArch, qemuCaps->arch))
return;
virQEMUCapsHostCPUDataClearModels(cpuData); virQEMUCapsHostCPUDataClearModels(cpuData);
} }
......
...@@ -58,6 +58,7 @@ virQEMUCapsSetArch(virQEMUCapsPtr qemuCaps, ...@@ -58,6 +58,7 @@ virQEMUCapsSetArch(virQEMUCapsPtr qemuCaps,
void void
virQEMUCapsFreeHostCPUModel(virQEMUCapsPtr qemuCaps, virQEMUCapsFreeHostCPUModel(virQEMUCapsPtr qemuCaps,
virArch hostArch,
virDomainVirtType type); virDomainVirtType type);
void void
......
...@@ -388,8 +388,10 @@ testUpdateQEMUCaps(const struct testInfo *info, ...@@ -388,8 +388,10 @@ testUpdateQEMUCaps(const struct testInfo *info,
if (testAddCPUModels(info->qemuCaps, info->skipLegacyCPUs) < 0) if (testAddCPUModels(info->qemuCaps, info->skipLegacyCPUs) < 0)
goto cleanup; goto cleanup;
virQEMUCapsFreeHostCPUModel(info->qemuCaps, VIR_DOMAIN_VIRT_KVM); virQEMUCapsFreeHostCPUModel(info->qemuCaps, caps->host.arch,
virQEMUCapsFreeHostCPUModel(info->qemuCaps, VIR_DOMAIN_VIRT_QEMU); VIR_DOMAIN_VIRT_KVM);
virQEMUCapsFreeHostCPUModel(info->qemuCaps, caps->host.arch,
VIR_DOMAIN_VIRT_QEMU);
virQEMUCapsInitHostCPUModel(info->qemuCaps, caps->host.arch, virQEMUCapsInitHostCPUModel(info->qemuCaps, caps->host.arch,
VIR_DOMAIN_VIRT_KVM); VIR_DOMAIN_VIRT_KVM);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册