mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-07 21:17:55 +03:00
qemu_process.c: modernize qemuProcessQMPNew()
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>
This commit is contained in:
parent
b677f0dbe0
commit
f187b2fb98
@ -8412,8 +8412,7 @@ qemuProcessQMPNew(const char *binary,
|
|||||||
gid_t runGid,
|
gid_t runGid,
|
||||||
bool forceTCG)
|
bool forceTCG)
|
||||||
{
|
{
|
||||||
qemuProcessQMPPtr ret = NULL;
|
g_autoptr(qemuProcessQMP) proc = NULL;
|
||||||
qemuProcessQMPPtr proc = NULL;
|
|
||||||
const char *threadSuffix;
|
const char *threadSuffix;
|
||||||
g_autofree char *threadName = NULL;
|
g_autofree char *threadName = NULL;
|
||||||
|
|
||||||
@ -8421,7 +8420,7 @@ qemuProcessQMPNew(const char *binary,
|
|||||||
binary, libDir, runUid, runGid, forceTCG);
|
binary, libDir, runUid, runGid, forceTCG);
|
||||||
|
|
||||||
if (VIR_ALLOC(proc) < 0)
|
if (VIR_ALLOC(proc) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
proc->binary = g_strdup(binary);
|
proc->binary = g_strdup(binary);
|
||||||
proc->libDir = g_strdup(libDir);
|
proc->libDir = g_strdup(libDir);
|
||||||
@ -8438,13 +8437,9 @@ qemuProcessQMPNew(const char *binary,
|
|||||||
threadName = g_strdup_printf("qmp-%s", threadSuffix);
|
threadName = g_strdup_printf("qmp-%s", threadSuffix);
|
||||||
|
|
||||||
if (!(proc->eventThread = virEventThreadNew(threadName)))
|
if (!(proc->eventThread = virEventThreadNew(threadName)))
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
ret = g_steal_pointer(&proc);
|
return g_steal_pointer(&proc);
|
||||||
|
|
||||||
cleanup:
|
|
||||||
qemuProcessQMPFree(proc);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user