From: Jonathon Jongsma Date: Fri, 23 Oct 2020 21:40:08 +0000 (-0500) Subject: qemu: fix memory leak reported by coverity X-Git-Tag: v6.9.0-rc1~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7653283df9aa5c59adbf44ce3e55bac9b6444b4d;p=thirdparty%2Flibvirt.git qemu: fix memory leak reported by coverity Let g_autoptr clean up on early return. Signed-off-by: Jonathon Jongsma Reviewed-by: Laine Stump --- diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index cba9ec7b19..604fcda1e3 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4013,7 +4013,7 @@ int qemuMonitorJSONAddFileHandleToSet(qemuMonitorPtr mon, const char *opaque, qemuMonitorAddFdInfoPtr fdinfo) { - virJSONValuePtr args = NULL; + g_autoptr(virJSONValue) args = NULL; g_autoptr(virJSONValue) reply = NULL; g_autoptr(virJSONValue) cmd = NULL; @@ -4024,7 +4024,7 @@ int qemuMonitorJSONAddFileHandleToSet(qemuMonitorPtr mon, if (virJSONValueObjectAdd(args, "j:fdset-id", fdset, NULL) < 0) return -1; - if (!(cmd = qemuMonitorJSONMakeCommandInternal("add-fd", args))) + if (!(cmd = qemuMonitorJSONMakeCommandInternal("add-fd", g_steal_pointer(&args)))) return -1; if (qemuMonitorJSONCommandWithFd(mon, cmd, fd, &reply) < 0)