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(a)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 7f58c16987..c4fa111836 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3104,11 +3104,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.28.0