[libvirt PATCH 5/6] libxl: use g_auto in libxlCapsNodeData

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Also remove pointless labels.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 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 NULL;
 
-    return cpudata;
-
- 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.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux