From nobody Sun Feb 8 16:53:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488703191329290.80853770776423; Sun, 5 Mar 2017 00:39:51 -0800 (PST) Received: from localhost ([::1]:37955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckRhm-0002TV-3a for importer@patchew.org; Sun, 05 Mar 2017 03:39:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckReA-0000Oc-0O for qemu-devel@nongnu.org; Sun, 05 Mar 2017 03:36:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ckRe7-0002xk-Ar for qemu-devel@nongnu.org; Sun, 05 Mar 2017 03:36:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42576) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ckRe7-0002wb-4A for qemu-devel@nongnu.org; Sun, 05 Mar 2017 03:36:03 -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 449248123D for ; Sun, 5 Mar 2017 08:36:03 +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 v258a1xa028570 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sun, 5 Mar 2017 03:36:03 -0500 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 8C55A1138604; Sun, 5 Mar 2017 09:35:58 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Sun, 5 Mar 2017 09:35:43 +0100 Message-Id: <1488702958-24336-13-git-send-email-armbru@redhat.com> In-Reply-To: <1488702958-24336-1-git-send-email-armbru@redhat.com> References: <1488702958-24336-1-git-send-email-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sun, 05 Mar 2017 08:36:03 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL v2 12/27] qapi: Make QObject input visitor set *list reliably X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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: <1488544368-30622-14-git-send-email-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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, cons= t char *name, QObject *qobj =3D qobject_input_get_object(qiv, name, true, errp); const QListEntry *entry; =20 + if (list) { + *list =3D NULL; + } if (!qobj) { return; } if (qobject_type(qobj) !=3D QTYPE_QLIST) { - if (list) { - *list =3D NULL; - } error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "list"); return; } =20 entry =3D qobject_input_push(qiv, qobj, list); - if (list) { - if (entry) { - *list =3D g_malloc0(size); - } else { - *list =3D NULL; - } + if (entry && list) { + *list =3D g_malloc0(size); } } =20 --=20 2.7.4