From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0IGi-0008OA-2y for qemu-devel@nongnu.org; Mon, 06 Jan 2014 17:03:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0IGb-0000yB-Ut for qemu-devel@nongnu.org; Mon, 06 Jan 2014 17:03:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46869) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0IGb-0000xr-Ni for qemu-devel@nongnu.org; Mon, 06 Jan 2014 17:03:25 -0500 From: Luiz Capitulino Date: Mon, 6 Jan 2014 17:03:06 -0500 Message-Id: <1389045795-18706-6-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1389045795-18706-1-git-send-email-lcapitulino@redhat.com> References: <1389045795-18706-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PULL 05/14] qom: catch errors in object_property_add_child List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: qemu-devel@nongnu.org From: Paolo Bonzini Signed-off-by: Paolo Bonzini Reviewed-by: Igor Mammedov Tested-by: Igor Mammedov Signed-off-by: Luiz Capitulino --- qom/object.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/qom/object.c b/qom/object.c index fc19cf6..4dee02b 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); } -- 1.8.1.4