From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwsRc-0008RN-NS for qemu-devel@nongnu.org; Fri, 05 Dec 2014 07:57:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XwsRY-0002Fe-9t for qemu-devel@nongnu.org; Fri, 05 Dec 2014 07:57:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44643) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwsRY-0002FW-2H for qemu-devel@nongnu.org; Fri, 05 Dec 2014 07:57:08 -0500 Message-ID: <5481AB9A.9020706@redhat.com> Date: Fri, 05 Dec 2014 05:56:58 -0700 From: Eric Blake MIME-Version: 1.0 References: <1417768210-9688-1-git-send-email-arei.gonglei@huawei.com> In-Reply-To: <1417768210-9688-1-git-send-email-arei.gonglei@huawei.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LmbVC7PTcUABu20jAoWUSTritr8RFMqk5" Subject: Re: [Qemu-devel] [PATCH v2] spice: fix memory leak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: arei.gonglei@huawei.com, qemu-devel@nongnu.org Cc: pbonzini@redhat.com, weidong.huang@huawei.com, kraxel@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --LmbVC7PTcUABu20jAoWUSTritr8RFMqk5 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 12/05/2014 01:30 AM, arei.gonglei@huawei.com wrote: > From: Gonglei >=20 > If errors happen for middle items of channel_list, > qmp_query_spice_channels() returns NULL, and the variable > cur_item going out of scope leaks the storage it points to. >=20 > The flag is a compatibility thing for older spice-server > versions. Meanwhile our minimum spice version requirement is > new enough that we should never ever see this error, and if we > do something went very seriously wrong. Let's using assert() > instead of returning NULL to avoid a memory leak. >=20 > Suggested-by: Paolo Bonzini > Signed-off-by: Gonglei > Reviewed-by: Eric Blake Putting in a R-b at the same time as fundamental changes (going from two loops to an assert) is not something I would have done if submitting the patch... > --- > v2:=20 > - using assert() instead of returning NULL. (Gerd) > - fix some typos. (Eric) > - add Eric's R-by tag, hope Eric has no objection > because of changes of v2. :) =2E..but at least you caught my attention, and I am okay with v2, so you can keep it now. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --LmbVC7PTcUABu20jAoWUSTritr8RFMqk5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUgauaAAoJEKeha0olJ0NqoRUIAKH9MPDFBIwFn8jvlZu9kJk8 jt5ir20LUhPfqDGwl8S7wN2hAvb3KOf1MHcd1/1L9XC5AZecvOaUqZkfb7tjS6I1 6LyFBaoLwEX84+zPXMGL5L8QZuEFzK85QCUtkTMhrIOU7yD5kYX9xuFFqvVRkNLF QaFLdbnigiYSMnXL2kqND9GAoFxtTz+JRAwEappA+uQ6d7qzjhA6w/WKQekQc9Ah puZ2lBexUPHA88xlNHYQ/IVGU9zymlw4WmycO8TeoNXPTyL/FZ1oYKh87tjPOZm8 F1Z6oeNqVg7pBtfACnAEFvoZWqWmMRtjMTZJ7g3Oy8DpxF/hir9Fx4ioWEfAW2M= =/ZOg -----END PGP SIGNATURE----- --LmbVC7PTcUABu20jAoWUSTritr8RFMqk5--