aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2014-01-16 17:34:36 +0100
committerLuiz Capitulino <lcapitulino@redhat.com>2014-01-28 11:28:08 -0500
commit69252c046741a0955ddb90250f416a2199305091 (patch)
treeac033d9b42e994701575d2fc14033ac160a9de66
parent0169c511554cb0014a00290b0d3d26c31a49818f (diff)
object_add: consolidate error handling
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
-rw-r--r--qmp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/qmp.c b/qmp.c
index 0f46171aad..a67e0c4539 100644
--- a/qmp.c
+++ b/qmp.c
@@ -549,15 +549,17 @@ void object_add(const char *type, const char *id, const QDict *qdict,
for (e = qdict_first(qdict); e; e = qdict_next(qdict, e)) {
object_property_set(obj, v, e->key, &local_err);
if (local_err) {
- error_propagate(errp, local_err);
- object_unref(obj);
- return;
+ goto out;
}
}
}
object_property_add_child(container_get(object_get_root(), "/objects"),
- id, obj, errp);
+ id, obj, &local_err);
+out:
+ if (local_err) {
+ error_propagate(errp, local_err);
+ }
object_unref(obj);
}