[libvirt] [PATCHv3 01/12] qemu: monitor: Don't leak @props with non-JSON in qemuMonitorAddObject

Peter Krempa pkrempa at redhat.com
Tue Mar 17 14:19:50 UTC 2015


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.
---

This patch is new in the series.

 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 18f866f..9b86695 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3245,11 +3245,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;
 }
-- 
2.2.2




More information about the libvir-list mailing list