提交 4f2fdad3 编写于 作者: J Jiri Denemark

cpu_x86: Use g_auto* in x86DataToCPU

Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 e43e2ff7
......@@ -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(&copy, &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, &copy, map) ||
x86DataToCPUFeatures(cpu, VIR_CPU_FEATURE_DISABLE, &modelData, map))
goto error;
cleanup:
virCPUx86DataClear(&modelData);
virCPUx86DataClear(&copy);
return cpu;
return NULL;
error:
virCPUDefFree(cpu);
cpu = NULL;
goto cleanup;
return g_steal_pointer(&cpu);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册