aboutsummaryrefslogtreecommitdiff
path: root/qmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'qmp.c')
-rw-r--r--qmp.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/qmp.c b/qmp.c
index a7f432b37e..b722dbec9a 100644
--- a/qmp.c
+++ b/qmp.c
@@ -565,13 +565,18 @@ void object_add(const char *type, const char *id, const QDict *qdict,
}
}
- user_creatable_complete(obj, &local_err);
+ object_property_add_child(container_get(object_get_root(), "/objects"),
+ id, obj, &local_err);
if (local_err) {
goto out;
}
- object_property_add_child(container_get(object_get_root(), "/objects"),
- id, obj, &local_err);
+ user_creatable_complete(obj, &local_err);
+ if (local_err) {
+ object_property_del(container_get(object_get_root(), "/objects"),
+ id, &error_abort);
+ goto out;
+ }
out:
if (local_err) {
error_propagate(errp, local_err);