Use g_auto and remove pointless labels.

Signed-off-by: Ján Tomko <jto...@redhat.com>
---
 src/qemu/qemu_capabilities.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index a80c172d71..380d0a5694 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1111,13 +1111,13 @@ virQEMUCapsProbeHostCPU(virArch hostArch,
 virCaps *
 virQEMUCapsInit(virFileCache *cache)
 {
-    virCaps *caps;
+    g_autoptr(virCaps) caps = NULL;
     size_t i;
     virArch hostarch = virArchFromHost();
 
     if ((caps = virCapabilitiesNew(hostarch,
                                    true, true)) == NULL)
-        goto error;
+        return NULL;
 
     if (virCapabilitiesInitCaches(caps) < 0)
         VIR_WARN("Failed to get host CPU cache info");
@@ -1145,13 +1145,9 @@ virQEMUCapsInit(virFileCache *cache)
         if (virQEMUCapsInitGuest(caps, cache,
                                  hostarch,
                                  i) < 0)
-            goto error;
+            return NULL;
 
-    return caps;
-
- error:
-    virObjectUnref(caps);
-    return NULL;
+    return g_steal_pointer(&caps);
 }
 
 
-- 
2.31.1

Reply via email to