From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cin6j-0001Yq-3Z for qemu-devel@nongnu.org; Tue, 28 Feb 2017 14:06:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cin6f-0006tK-3B for qemu-devel@nongnu.org; Tue, 28 Feb 2017 14:06:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46416) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cin6e-0006sS-Ui for qemu-devel@nongnu.org; Tue, 28 Feb 2017 14:06:41 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 21D708124A for ; Tue, 28 Feb 2017 19:06:41 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-55.ams2.redhat.com [10.36.116.55]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SJ6d5I031361 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 28 Feb 2017 14:06:40 -0500 From: Markus Armbruster Date: Tue, 28 Feb 2017 20:06:21 +0100 Message-Id: <1488308796-28832-12-git-send-email-armbru@redhat.com> In-Reply-To: <1488308796-28832-1-git-send-email-armbru@redhat.com> References: <1488308796-28832-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PULL 11/26] qapi: Make QObject input visitor set *list reliably List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org qobject_input_start_struct() sets *list, except when it fails because qobject_input_get_object() fails, i.e. the input object doesn't exist. All the other input visitor start_struct(), start_list(), start_alternate() always set *obj / *list. Change qobject_input_start_struct() to match. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Message-Id: <1488303560-18803-12-git-send-email-armbru@redhat.com> --- qapi/qobject-input-visitor.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c index 2c2f883..d58696c 100644 --- a/qapi/qobject-input-visitor.c +++ b/qapi/qobject-input-visitor.c @@ -196,25 +196,21 @@ static void qobject_input_start_list(Visitor *v, const char *name, QObject *qobj = qobject_input_get_object(qiv, name, true, errp); const QListEntry *entry; + if (list) { + *list = NULL; + } if (!qobj) { return; } if (qobject_type(qobj) != QTYPE_QLIST) { - if (list) { - *list = NULL; - } error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "list"); return; } entry = qobject_input_push(qiv, qobj, list); - if (list) { - if (entry) { - *list = g_malloc0(size); - } else { - *list = NULL; - } + if (entry && list) { + *list = g_malloc0(size); } } -- 2.7.4