From b15f58838504855f52d89157d99b9f40954fbf81 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 16 Mar 2015 15:25:58 +0100 Subject: [PATCH] qemu: monitor: Don't leak @props with non-JSON in qemuMonitorAddObject The function comment states that @props is always consumed, even on failure. This was not true with the failure if the monitor is not using QMP. --- src/qemu/qemu_monitor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 5d39ce8caf..07e3cb908f 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3246,11 +3246,13 @@ qemuMonitorAddObject(qemuMonitorPtr mon, mon, type, objalias, props); int ret = -1; - if (mon->json) + if (mon->json) { ret = qemuMonitorJSONAddObject(mon, type, objalias, props); - else + } else { + virJSONValueFree(props); virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("object adding requires JSON monitor")); + } return ret; } -- GitLab