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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]