mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 21:15:20 +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,
|
||||
virDomainCapsCPUModelPtr hvModel)
|
||||
{
|
||||
virCPUDefPtr cpu;
|
||||
virCPUx86Data copy = VIR_CPU_X86_DATA_INIT;
|
||||
virCPUx86Data modelData = VIR_CPU_X86_DATA_INIT;
|
||||
g_autoptr(virCPUDef) cpu = NULL;
|
||||
g_auto(virCPUx86Data) copy = VIR_CPU_X86_DATA_INIT;
|
||||
g_auto(virCPUx86Data) modelData = VIR_CPU_X86_DATA_INIT;
|
||||
virCPUx86VendorPtr vendor;
|
||||
|
||||
cpu = virCPUDefNew();
|
||||
@ -801,7 +801,7 @@ x86DataToCPU(const virCPUx86Data *data,
|
||||
if ((feature = x86FeatureFind(map, *blocker)) &&
|
||||
!x86DataIsSubset(©, &feature->data))
|
||||
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) ||
|
||||
x86DataToCPUFeatures(cpu, VIR_CPU_FEATURE_DISABLE, &modelData, map))
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
cleanup:
|
||||
virCPUx86DataClear(&modelData);
|
||||
virCPUx86DataClear(©);
|
||||
return cpu;
|
||||
|
||||
error:
|
||||
virCPUDefFree(cpu);
|
||||
cpu = NULL;
|
||||
goto cleanup;
|
||||
return g_steal_pointer(&cpu);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user