[PATCH 07/12] qemuMonitorAddObject: Fix semantics of @alias

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

 



The callers of qemuMonitorAddObject rely on the fact that @alias is
filled only when the object is added successfully. This is documented
but the code didn't behave like that.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_monitor.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index a55c4e19dd..7919eb3a04 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3076,11 +3076,14 @@ qemuMonitorAddObject(qemuMonitorPtr mon,
     if (alias)
         tmp = g_strdup(id);

-    ret = qemuMonitorJSONAddObject(mon, props);
+    if (qemuMonitorJSONAddObject(mon, props) < 0)
+        goto cleanup;

     if (alias)
         *alias = g_steal_pointer(&tmp);

+    ret = 0;
+
  cleanup:
     VIR_FREE(tmp);
     virJSONValueFree(*props);
-- 
2.29.2




[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]

  Powered by Linux