diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-12-20 23:21:08 +0100 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2014-01-06 13:45:47 -0500 |
commit | b0ed5e9feaf0e2881330a48c692f62e1ac6d9052 (patch) | |
tree | 8f4188946691ecb7c594d5dafb57561b5a5b5adb /qom/object.c | |
parent | 28ec2598ff7d74bd9556a1786f45fc5df2aacfe1 (diff) |
qom: catch errors in object_property_add_child
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'qom/object.c')
-rw-r--r-- | qom/object.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/qom/object.c b/qom/object.c index fc19cf676a..4dee02b6e2 100644 --- a/qom/object.c +++ b/qom/object.c @@ -988,17 +988,22 @@ static void object_finalize_child_property(Object *obj, const char *name, void object_property_add_child(Object *obj, const char *name, Object *child, Error **errp) { + Error *local_err = NULL; gchar *type; type = g_strdup_printf("child<%s>", object_get_typename(OBJECT(child))); - object_property_add(obj, name, type, object_get_child_property, - NULL, object_finalize_child_property, child, errp); - + object_property_add(obj, name, type, object_get_child_property, NULL, + object_finalize_child_property, child, &local_err); + if (local_err) { + error_propagate(errp, local_err); + goto out; + } object_ref(child); g_assert(child->parent == NULL); child->parent = obj; +out: g_free(type); } |