]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_process.c: modernize qemuProcessQMPNew()
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Fri, 17 Jul 2020 21:15:53 +0000 (18:15 -0300)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 21 Jul 2020 13:34:36 +0000 (15:34 +0200)
Use g_autoptr() and remove the 'cleanup' label.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20200717211556.1024748-3-danielhb413@gmail.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_process.c

index c779c2124068c7c936cfaf87b380647acae0e41e..b985524258c6729b19d6ec7085c3ebca614a45a3 100644 (file)
@@ -8412,8 +8412,7 @@ qemuProcessQMPNew(const char *binary,
                   gid_t runGid,
                   bool forceTCG)
 {
-    qemuProcessQMPPtr ret = NULL;
-    qemuProcessQMPPtr proc = NULL;
+    g_autoptr(qemuProcessQMP) proc = NULL;
     const char *threadSuffix;
     g_autofree char *threadName = NULL;
 
@@ -8421,7 +8420,7 @@ qemuProcessQMPNew(const char *binary,
               binary, libDir, runUid, runGid, forceTCG);
 
     if (VIR_ALLOC(proc) < 0)
-        goto cleanup;
+        return NULL;
 
     proc->binary = g_strdup(binary);
     proc->libDir = g_strdup(libDir);
@@ -8438,13 +8437,9 @@ qemuProcessQMPNew(const char *binary,
     threadName = g_strdup_printf("qmp-%s", threadSuffix);
 
     if (!(proc->eventThread = virEventThreadNew(threadName)))
-        goto cleanup;
-
-    ret = g_steal_pointer(&proc);
+        return NULL;
 
- cleanup:
-    qemuProcessQMPFree(proc);
-    return ret;
+    return g_steal_pointer(&proc);
 }