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>
This commit is contained in:
Igor Mammedov 2014-01-16 17:34:36 +01:00 committed by Luiz Capitulino
parent 0169c51155
commit 69252c0467
1 changed files with 6 additions and 4 deletions

10
qmp.c
View File

@ -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);
}