[PATCH 07/12] qemuMonitorAddObject: Fix semantics of @alias
Peter Krempa
pkrempa at redhat.com
Wed Jan 6 14:03:38 UTC 2021
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 at redhat.com>
---
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
More information about the libvir-list
mailing list