]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: monitor: Don't leak @props with non-JSON in qemuMonitorAddObject
authorPeter Krempa <pkrempa@redhat.com>
Mon, 16 Mar 2015 14:25:58 +0000 (15:25 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 23 Mar 2015 13:25:14 +0000 (14:25 +0100)
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

index 5d39ce8caf74003349a23c324a85d12f206a2baa..07e3cb908fb5ebcf99135c6e062c7f2805c7b598 100644 (file)
@@ -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;
 }