From: Ján Tomko Date: Sun, 5 Sep 2021 19:22:51 +0000 (+0200) Subject: libxl: use g_auto in libxlCapsNodeData X-Git-Tag: v7.8.0-rc1~301 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6cd7a478faf9a7f5f26c622b526f09c40e46b19;p=thirdparty%2Flibvirt.git libxl: use g_auto in libxlCapsNodeData Also remove pointless labels. Signed-off-by: Ján Tomko Reviewed-by: Jim Fehlig --- 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