From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aoCj0-0003uF-5K for qemu-devel@nongnu.org; Thu, 07 Apr 2016 12:24:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aoCiw-0002dT-6l for qemu-devel@nongnu.org; Thu, 07 Apr 2016 12:24:06 -0400 References: <1459526222-30052-1-git-send-email-eblake@redhat.com> <56FEA749.7080509@redhat.com> <8737qxxxh8.fsf@dusky.pond.sub.org> From: Eric Blake Message-ID: <57068999.9010100@redhat.com> Date: Thu, 7 Apr 2016 10:23:53 -0600 MIME-Version: 1.0 In-Reply-To: <8737qxxxh8.fsf@dusky.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Swe39VOp9SeKeSaS5ecbrfCPC1BDHcSRN" Subject: Re: [Qemu-devel] [Qemu-block] [PATCH for-2.6] crypto: Avoid memory leak on failure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , Max Reitz Cc: Kevin Wolf , qemu-devel@nongnu.org, "open list:Block layer core" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Swe39VOp9SeKeSaS5ecbrfCPC1BDHcSRN Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04/07/2016 09:14 AM, Markus Armbruster wrote: > Max Reitz writes: >=20 >> On 01.04.2016 17:57, Eric Blake wrote: >>> Commit 7836857 introduced a memory leak due to invalid use of >>> Error vs. visit_type_end(). If visiting the intermediate >>> members fails, we clear the error and unconditionally use >>> visit_end_struct() on the same error object; but if that >>> cleanup succeeds, we then skip the qapi_free call. >> >> It's not really a memleak. Due to skipping those conditional branches >> after the "out" label, a non-null value will be returned. In order to >> determine whether the function call failed, the callers of these >> functions do not use the errp value but the return value. Therefore, >> they will think the call succeeded when actually it did not. >=20 > Please amend the commit message accordingly. Too late; already merged as 95c3df5a. [And welcome back - hope you don't mind the backlog...] (Locally it looks like a memory leak; it is only the wider analysis that shows that the caller is not leaking things, but where the bug then shifts to being a potential for the caller to abort if it tries to set an error into the already-set errp) --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Swe39VOp9SeKeSaS5ecbrfCPC1BDHcSRN 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/ iQEcBAEBCAAGBQJXBomZAAoJEKeha0olJ0Nqrq8IAK+sMJ+QTWRLOjcreHfrz5UB zEkVzpDt+nT0fooLKIcM5kY3M/gYA0zU8hb5+0864+l9GluBT0K+8/8+2YwXqXTy NuxM2NcF4yPGBxTei2ixeFZGxUFVB8H4Zl54GRCS5hkxGFiCVv77Bq2HC+PaINFj MWm1+WSiGMg4JHE7SYqx55HtfFSBTC0S2jwyY2euc6C+NEPQwZwAupauLH2Cjxy8 q/HkTwnr8sn70hkEvglq3oVB2x63VtBB/eMB5R5SbgMRlh1WeHK+qCPUsL1ArQps LRcPCiCBCCo8vXBSq9m3ykp8XtRmRuvDvBBHy0T/WZKaPwfYUT3rHJWCYvlPG04= =TcjO -----END PGP SIGNATURE----- --Swe39VOp9SeKeSaS5ecbrfCPC1BDHcSRN--