Use g_autoptr() and remove the 'cleanup' label.
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_process.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 70fc24b993..a11eedda16 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8395,8 +8395,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;
@@ -8404,7 +8403,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);
@@ -8421,13 +8420,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);
}
--
2.26.2