From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33985) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKwdJ-0000RG-N0 for qemu-devel@nongnu.org; Thu, 30 Jul 2015 18:49:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZKwdE-0002Ri-PR for qemu-devel@nongnu.org; Thu, 30 Jul 2015 18:49:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42892) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKwdE-0002Rc-He for qemu-devel@nongnu.org; Thu, 30 Jul 2015 18:48:56 -0400 References: <1435782155-31412-1-git-send-email-armbru@redhat.com> <1435782155-31412-30-git-send-email-armbru@redhat.com> <55B025B9.2060004@redhat.com> <87zj2gohv1.fsf@blackfin.pond.sub.org> <55B79754.6090609@redhat.com> <87y4hzicto.fsf@blackfin.pond.sub.org> <55B8F40E.9020301@redhat.com> <877fpic20s.fsf@blackfin.pond.sub.org> <55BA3270.90309@redhat.com> <87lhdxy6wy.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <55BAA9D2.6020205@redhat.com> Date: Thu, 30 Jul 2015 16:48:50 -0600 MIME-Version: 1.0 In-Reply-To: <87lhdxy6wy.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="uSTK0njJ1Af7ncNqo6xN3ok2FOTcdnk5P" Subject: Re: [Qemu-devel] [PATCH RFC v2 29/47] qapi: Replace dirty is_c_ptr() by method c_null() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, berto@igalia.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --uSTK0njJ1Af7ncNqo6xN3ok2FOTcdnk5P Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/30/2015 09:57 AM, Markus Armbruster wrote: >> For qmp_FOO(), this is a reasonable contract. But our very own >> generated code does not follow these rules: visit_type_FOO() can assig= n >> into *obj even when setting an error, if it encounters a parse error >> halfway through the struct, leaving the caller responsible to still >> clean up the mess if it wants to avoid a memory leak. >=20 > Assigning to *obj, then fail is tolerable[*]. Relying on the caller to= > free it is not. If we do that, it's a bug. >=20 >> Maybe that means our generated code needs to be reworked to properly >> clean up on a failed parse, such that *obj is guaranteed to be NULL if= >> an error is returned. As a separate patch, of course. >=20 > Yes. Would you like to propose a FIXME for me to put into this series?= Done (see 12.5/47). >=20 >=20 > [*] Leaving *obj alone on failure is nicer, but may not always be > practical. I'm wondering if visit_end_struct() should be changed to accept a bool parameter that is true if the struct is ended normally, and false if an error has been detected. We may also need to alter visit_start_struct to return a bool (true if an object was allocated), to help feed our visitor logic on whether to pass true or false to the visit_end_struct().= We did something like that for visit_start_union()/visit_end_union(), but I suspect those visitor interfaces are also a bit screwy. Oh well, I'm not going to try and tweak it today, but am happy with just adding the FIXME. Also, it would be really nice if we had docs in visitor.h and/or visitor-impl.h, to get some sort of feel for how the visitor is supposed to be used. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --uSTK0njJ1Af7ncNqo6xN3ok2FOTcdnk5P Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVuqnSAAoJEKeha0olJ0NqYMgH/AnkurfyanCD4hix8Eisrlvz ZjpzXw+peFhWBj253LVgDD+cKJIM2v1KxzNYcAJVE3IWlcCEptNr7gH2ERb9ieHF scm5aXsf0QhtD/LkUfZkvrjm8bkumDY2NdiQMSLg34+j+fvm1DUBvFO+q1YZ4CkD P/k2uMT9Wqr8aB3a20AV41W/XarJtvI3ZUwN7VtV8RsvY4UdsBpxhw1/kbZfmZTr ++58Pb+yt/p0Nv3PX8NZwddhekW/wz90mzacjcK0hCkxC1pfuEhcuTTM0QF+yFu5 WoB4CPKe4le7HIwQL0Ras1mag1FSSZ2zliUts6QJKD5q7JqREUK81vfDu5jX8k4= =+zKf -----END PGP SIGNATURE----- --uSTK0njJ1Af7ncNqo6xN3ok2FOTcdnk5P--