From patchwork Wed Dec 18 17:00:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 302999 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D55702C007B for ; Thu, 19 Dec 2013 04:25:15 +1100 (EST) Received: from localhost ([::1]:39853 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtKrw-0003z7-T7 for incoming@patchwork.ozlabs.org; Wed, 18 Dec 2013 12:25:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtKqL-0001qD-Aq for qemu-devel@nongnu.org; Wed, 18 Dec 2013 12:23:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtKqD-0000Gy-TT for qemu-devel@nongnu.org; Wed, 18 Dec 2013 12:23:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:8076) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtKqD-0000Gg-Ls for qemu-devel@nongnu.org; Wed, 18 Dec 2013 12:23:25 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rBIHNMtq012589 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 18 Dec 2013 12:23:24 -0500 Received: from localhost (ovpn-113-56.phx2.redhat.com [10.3.113.56]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rBIH0GUV032295; Wed, 18 Dec 2013 12:00:17 -0500 From: Luiz Capitulino To: anthony@codemonkey.ws Date: Wed, 18 Dec 2013 12:00:00 -0500 Message-Id: <1387386003-8949-11-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1387386003-8949-1-git-send-email-lcapitulino@redhat.com> References: <1387386003-8949-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 10/13] qom: catch errors in object_property_add_child X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Paolo Bonzini Signed-off-by: Paolo Bonzini Reviewed-By: Igor Mammedov Signed-off-by: Luiz Capitulino --- 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); - + NULL, object_finalize_child_property, child, &local_err); + if (error_is_set(&local_err)) { + error_propagate(errp, local_err); + goto out; + } object_ref(child); g_assert(child->parent == NULL); child->parent = obj; +out: g_free(type); }