From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vu8Rh-00082R-Pg for qemu-devel@nongnu.org; Fri, 20 Dec 2013 17:21:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vu8Rg-0005dQ-Vd for qemu-devel@nongnu.org; Fri, 20 Dec 2013 17:21:25 -0500 Received: from mail-ee0-x233.google.com ([2a00:1450:4013:c00::233]:41997) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vu8Rg-0005dH-Nr for qemu-devel@nongnu.org; Fri, 20 Dec 2013 17:21:24 -0500 Received: by mail-ee0-f51.google.com with SMTP id b15so1322264eek.10 for ; Fri, 20 Dec 2013 14:21:23 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 20 Dec 2013 23:21:08 +0100 Message-Id: <1387578070-2884-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1387578070-2884-1-git-send-email-pbonzini@redhat.com> References: <1387578070-2884-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH v3 3/5] qom: catch errors in object_property_add_child List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: imammedo@redhat.com, afaerber@suse.de, lcapitulino@xilinx.com Signed-off-by: Paolo Bonzini --- qom/object.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/qom/object.c b/qom/object.c index fc19cf6..68fe07a 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.4.2