qemu: fix memory leak reported by coverity
Let g_autoptr clean up on early return. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
e4648736be
commit
7653283df9
@ -4013,7 +4013,7 @@ int qemuMonitorJSONAddFileHandleToSet(qemuMonitorPtr mon,
|
|||||||
const char *opaque,
|
const char *opaque,
|
||||||
qemuMonitorAddFdInfoPtr fdinfo)
|
qemuMonitorAddFdInfoPtr fdinfo)
|
||||||
{
|
{
|
||||||
virJSONValuePtr args = NULL;
|
g_autoptr(virJSONValue) args = NULL;
|
||||||
g_autoptr(virJSONValue) reply = NULL;
|
g_autoptr(virJSONValue) reply = NULL;
|
||||||
g_autoptr(virJSONValue) cmd = NULL;
|
g_autoptr(virJSONValue) cmd = NULL;
|
||||||
|
|
||||||
@ -4024,7 +4024,7 @@ int qemuMonitorJSONAddFileHandleToSet(qemuMonitorPtr mon,
|
|||||||
if (virJSONValueObjectAdd(args, "j:fdset-id", fdset, NULL) < 0)
|
if (virJSONValueObjectAdd(args, "j:fdset-id", fdset, NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!(cmd = qemuMonitorJSONMakeCommandInternal("add-fd", args)))
|
if (!(cmd = qemuMonitorJSONMakeCommandInternal("add-fd", g_steal_pointer(&args))))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorJSONCommandWithFd(mon, cmd, fd, &reply) < 0)
|
if (qemuMonitorJSONCommandWithFd(mon, cmd, fd, &reply) < 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user