Received: from eggs.gnu.org ([2001:4830:134:3::10]:40488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmjNe-0003GX-1W for qemu-devel@nongnu.org; Wed, 21 Sep 2016 11:24:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmjNa-0003Wh-0z for qemu-devel@nongnu.org; Wed, 21 Sep 2016 11:24:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49424) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmjNZ-0003WQ-Qj for qemu-devel@nongnu.org; Wed, 21 Sep 2016 11:24:09 -0400 From: Markus Armbruster References: <20160921103629.6410-1-marcandre.lureau@redhat.com> <20160921103629.6410-3-marcandre.lureau@redhat.com> Date: Wed, 21 Sep 2016 17:24:06 +0200 In-Reply-To: <20160921103629.6410-3-marcandre.lureau@redhat.com> (=?utf-8?Q?=22Marc-Andr=C3=A9?= Lureau"'s message of "Wed, 21 Sep 2016 14:36:28 +0400") Message-ID: <874m59xomh.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/3] qapi: clear given pointer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Cc: qemu-devel@nongnu.org, berto@igalia.com Marc-Andr=C3=A9 Lureau writes: > Some getters already set *obj argument to NULL early, let's do this for > all for consistent behaviour in case of errors. > > Signed-off-by: Marc-Andr=C3=A9 Lureau > --- > qapi/qmp-input-visitor.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c > index ea9972d..cb9d196 100644 > --- a/qapi/qmp-input-visitor.c > +++ b/qapi/qmp-input-visitor.c > @@ -322,11 +322,13 @@ static void qmp_input_type_str(Visitor *v, const ch= ar *name, char **obj, > QObject *qobj =3D qmp_input_get_object(qiv, name, true, errp); > QString *qstr =3D qobject_to_qstring(qobj); >=20=20 > + if (obj) { > + *obj =3D NULL; > + } > if (!qobj) { > return; > } > if (!qstr) { > - *obj =3D NULL; > error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "nul= l", > "string"); > return; This undoes damage done in PATCH 1. > @@ -368,6 +370,9 @@ static void qmp_input_type_any(Visitor *v, const char= *name, QObject **obj, > QmpInputVisitor *qiv =3D to_qiv(v); > QObject *qobj =3D qmp_input_get_object(qiv, name, true, errp); >=20=20 > + if (obj) { > + *obj =3D NULL; > + } > if (!qobj) { > return; > } Likewise. Similar damage done to qmp_input_start_list() and possibly others. Please squash into PATCH 1 and double-check your new error returns affect *obj like the existing ones.