mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-03 02:15:23 +00:00
cpu_x86: Use g_auto* in x86DataToCPU
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
e43e2ff7f5
commit
4f2fdad36d
@ -771,9 +771,9 @@ x86DataToCPU(const virCPUx86Data *data,
|
|||||||
virCPUx86MapPtr map,
|
virCPUx86MapPtr map,
|
||||||
virDomainCapsCPUModelPtr hvModel)
|
virDomainCapsCPUModelPtr hvModel)
|
||||||
{
|
{
|
||||||
virCPUDefPtr cpu;
|
g_autoptr(virCPUDef) cpu = NULL;
|
||||||
virCPUx86Data copy = VIR_CPU_X86_DATA_INIT;
|
g_auto(virCPUx86Data) copy = VIR_CPU_X86_DATA_INIT;
|
||||||
virCPUx86Data modelData = VIR_CPU_X86_DATA_INIT;
|
g_auto(virCPUx86Data) modelData = VIR_CPU_X86_DATA_INIT;
|
||||||
virCPUx86VendorPtr vendor;
|
virCPUx86VendorPtr vendor;
|
||||||
|
|
||||||
cpu = virCPUDefNew();
|
cpu = virCPUDefNew();
|
||||||
@ -801,7 +801,7 @@ x86DataToCPU(const virCPUx86Data *data,
|
|||||||
if ((feature = x86FeatureFind(map, *blocker)) &&
|
if ((feature = x86FeatureFind(map, *blocker)) &&
|
||||||
!x86DataIsSubset(©, &feature->data))
|
!x86DataIsSubset(©, &feature->data))
|
||||||
if (x86DataAdd(&modelData, &feature->data) < 0)
|
if (x86DataAdd(&modelData, &feature->data) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,17 +810,9 @@ x86DataToCPU(const virCPUx86Data *data,
|
|||||||
|
|
||||||
if (x86DataToCPUFeatures(cpu, VIR_CPU_FEATURE_REQUIRE, ©, map) ||
|
if (x86DataToCPUFeatures(cpu, VIR_CPU_FEATURE_REQUIRE, ©, map) ||
|
||||||
x86DataToCPUFeatures(cpu, VIR_CPU_FEATURE_DISABLE, &modelData, map))
|
x86DataToCPUFeatures(cpu, VIR_CPU_FEATURE_DISABLE, &modelData, map))
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
cleanup:
|
return g_steal_pointer(&cpu);
|
||||||
virCPUx86DataClear(&modelData);
|
|
||||||
virCPUx86DataClear(©);
|
|
||||||
return cpu;
|
|
||||||
|
|
||||||
error:
|
|
||||||
virCPUDefFree(cpu);
|
|
||||||
cpu = NULL;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user