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

cpu_x86: Use g_auto* in virCPUx86GetHost

Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 3b5f1ca5
...@@ -2637,18 +2637,18 @@ static int ...@@ -2637,18 +2637,18 @@ static int
virCPUx86GetHost(virCPUDefPtr cpu, virCPUx86GetHost(virCPUDefPtr cpu,
virDomainCapsCPUModelsPtr models) virDomainCapsCPUModelsPtr models)
{ {
virCPUDataPtr cpuData = NULL; g_autoptr(virCPUData) cpuData = NULL;
int ret = -1; int ret;
if (virCPUx86DriverInitialize() < 0) if (virCPUx86DriverInitialize() < 0)
goto cleanup; return -1;
if (!(cpuData = virCPUDataNew(archs[0]))) if (!(cpuData = virCPUDataNew(archs[0])))
goto cleanup; return -1;
if (cpuidSet(CPUX86_BASIC, cpuData) < 0 || if (cpuidSet(CPUX86_BASIC, cpuData) < 0 ||
cpuidSet(CPUX86_EXTENDED, cpuData) < 0) cpuidSet(CPUX86_EXTENDED, cpuData) < 0)
goto cleanup; return -1;
/* Read the IA32_ARCH_CAPABILITIES MSR (0x10a) if supported. /* Read the IA32_ARCH_CAPABILITIES MSR (0x10a) if supported.
* This is best effort since there might be no way to read the MSR * This is best effort since there might be no way to read the MSR
...@@ -2668,7 +2668,7 @@ virCPUx86GetHost(virCPUDefPtr cpu, ...@@ -2668,7 +2668,7 @@ virCPUx86GetHost(virCPUDefPtr cpu,
}; };
if (virCPUx86DataAdd(cpuData, &item) < 0) if (virCPUx86DataAdd(cpuData, &item) < 0)
goto cleanup; return -1;
} }
} }
...@@ -2684,8 +2684,6 @@ virCPUx86GetHost(virCPUDefPtr cpu, ...@@ -2684,8 +2684,6 @@ virCPUx86GetHost(virCPUDefPtr cpu,
VIR_DEBUG("Host CPU does not support invariant TSC"); VIR_DEBUG("Host CPU does not support invariant TSC");
} }
cleanup:
virCPUx86DataFree(cpuData);
return ret; return ret;
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册