From: Daniel Henrique Barboza Date: Fri, 17 Jul 2020 21:15:53 +0000 (-0300) Subject: qemu_process.c: modernize qemuProcessQMPNew() X-Git-Tag: v6.6.0-rc1~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f187b2fb98136ff15ab84251488fc504b87703de;p=thirdparty%2Flibvirt.git qemu_process.c: modernize qemuProcessQMPNew() Use g_autoptr() and remove the 'cleanup' label. Signed-off-by: Daniel Henrique Barboza Message-Id: <20200717211556.1024748-3-danielhb413@gmail.com> Reviewed-by: Jiri Denemark --- diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c779c21240..b985524258 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -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); }