]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
libxl: use g_auto in libxlCapsNodeData
authorJán Tomko <jtomko@redhat.com>
Sun, 5 Sep 2021 19:22:51 +0000 (21:22 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 8 Sep 2021 14:19:55 +0000 (16:19 +0200)
Also remove pointless labels.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
src/libxl/libxl_capabilities.c

index 38a9b36d8bc4866735858b63723b0d7e3f5faec0..ef77bec7a0f8b39845bf527eb8bb3d6806a86465 100644 (file)
@@ -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