From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmiir-0001sk-V1 for qemu-devel@nongnu.org; Wed, 21 Sep 2016 10:42:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmiio-0003YY-Oq for qemu-devel@nongnu.org; Wed, 21 Sep 2016 10:42:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmiio-0003YO-JX for qemu-devel@nongnu.org; Wed, 21 Sep 2016 10:42:02 -0400 Date: Wed, 21 Sep 2016 15:41:58 +0100 From: "Daniel P. Berrange" Message-ID: <20160921144158.GT15535@redhat.com> Reply-To: "Daniel P. Berrange" References: <20160921103629.6410-1-marcandre.lureau@redhat.com> <20160921103629.6410-3-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160921103629.6410-3-marcandre.lureau@redhat.com> 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, armbru@redhat.com On Wed, Sep 21, 2016 at 02:36:28PM +0400, Marc-Andr=C3=A9 Lureau wrote: > Some getters already set *obj argument to NULL early, let's do this for > all for consistent behaviour in case of errors. >=20 > Signed-off-by: Marc-Andr=C3=A9 Lureau If we want consistent behaviour, there's plenty more visit methods that need updating beyond these two. eg input_type_int64 will leave '*obj' untouched on error. In fact if we want to have '*obj' given a NULL value on error, then it seems we should instead add code to 'qapi-visit-core.c' to always initialize '*obj' to NULL, instead of doing it in qmp-input-visitor.c That way all visitor implementations get the same behaviour Alternatively, we could say that '*obj' should never be touched on error paths, in which case we've a bunchof cleanup todo in qmp_input_visitor to avoid splattering *obj. Regards, Daniel --=20 |: http://berrange.com -o- http://www.flickr.com/photos/dberrange= / :| |: http://libvirt.org -o- http://virt-manager.or= g :| |: http://autobuild.org -o- http://search.cpan.org/~danberr= / :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vn= c :|