From d6cd7a478faf9a7f5f26c622b526f09c40e46b19 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A1n=20Tomko?= Date: Sun, 5 Sep 2021 21:22:51 +0200 Subject: [PATCH] libxl: use g_auto in libxlCapsNodeData MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Also remove pointless labels. Signed-off-by: Ján Tomko Reviewed-by: Jim Fehlig --- src/libxl/libxl_capabilities.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index 38a9b36d8b..ef77bec7a0 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -104,7 +104,7 @@ static virCPUData * libxlCapsNodeData(virCPUDef *cpu, libxl_hwcap hwcap) { ssize_t ncaps; - virCPUData *cpudata = NULL; + g_autoptr(virCPUData) cpudata = NULL; virCPUx86CPUID cpuid[] = { { .eax_in = 0x00000001, .edx = hwcap[0] }, { .eax_in = 0x00000001, .ecx = hwcap[1] }, @@ -117,17 +117,13 @@ libxlCapsNodeData(virCPUDef *cpu, libxl_hwcap hwcap) }; if (!(cpudata = virCPUDataNew(cpu->arch))) - goto error; + return NULL; ncaps = G_N_ELEMENTS(cpuid); if (libxlCapsAddCPUID(cpudata, cpuid, ncaps) < 0) - goto error; - - return cpudata; + return NULL; - error: - virCPUDataFree(cpudata); - return NULL; + return g_steal_pointer(&cpudata); } /* hw_caps is an array of 32-bit words whose meaning is listed in -- 2.47.2