Received: from eggs.gnu.org ([2001:4830:134:3::10]:51207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bth6S-00069U-Du for qemu-devel@nongnu.org; Mon, 10 Oct 2016 16:23:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bth6O-0007ka-6f for qemu-devel@nongnu.org; Mon, 10 Oct 2016 16:23:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bth6N-0007kT-TN for qemu-devel@nongnu.org; Mon, 10 Oct 2016 16:23:12 -0400 References: <1476092814-5199-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> From: Eric Blake Message-ID: <86198b60-9fb9-7663-0177-d4f032b66047@redhat.com> Date: Mon, 10 Oct 2016 15:23:10 -0500 MIME-Version: 1.0 In-Reply-To: <1476092814-5199-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="WtVhKil0IaKNtG8era6Eao9jtgamS6t6W" Subject: Re: [Qemu-devel] [PATCH] colo-proxy: fix memory leak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhang Chen , qemu devel , Jason Wang , Li Zhijian , Paolo Bonzini This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --WtVhKil0IaKNtG8era6Eao9jtgamS6t6W From: Eric Blake To: Zhang Chen , qemu devel , Jason Wang , Li Zhijian , Paolo Bonzini Message-ID: <86198b60-9fb9-7663-0177-d4f032b66047@redhat.com> Subject: Re: [Qemu-devel] [PATCH] colo-proxy: fix memory leak References: <1476092814-5199-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> In-Reply-To: <1476092814-5199-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/10/2016 04:46 AM, Zhang Chen wrote: > Fix memory leak in colo-compare.c and filter-rewriter.c > Report by Coverity. >=20 > Signed-off-by: Zhang Chen > --- > net/colo-compare.c | 4 ++-- > net/filter-rewriter.c | 9 +++++---- > 2 files changed, 7 insertions(+), 6 deletions(-) >=20 > diff --git a/net/colo-compare.c b/net/colo-compare.c > index 22b1da1..47e7ebe 100644 > --- a/net/colo-compare.c > +++ b/net/colo-compare.c > @@ -235,8 +235,8 @@ static int colo_packet_compare_tcp(Packet *spkt, Pa= cket *ppkt) > fprintf(stderr, "Secondary len =3D %d\n", spkt->size); > qemu_hexdump((char *)spkt->data, stderr, "colo-compare", spkt-= >size); > =20 > - g_free(sdebug); > - g_free(ddebug); > + free(sdebug); > + free(ddebug); Uggh. We should fix the original allocations of sdebug and ddebug to use g_strdup_printf() rather than strdup(), so that we are using a consistent allocator throughout. Or even improve this code to use traces instead of fprintf. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --WtVhKil0IaKNtG8era6Eao9jtgamS6t6W 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/ iQEcBAEBCAAGBQJX+/iuAAoJEKeha0olJ0NqEIEH/j3JhYlWKKExWzkqhGmnuGIn Pm8Af1z7SDJMFKyYqCO6kkFlcIugS5ztUKow15vcTzLHqc4Vg9uMRtRBlvRx57Wr ysKqRbOy0Y5b6UYhnhQaLWxeuqxUzBOGVk5Cu+L7F47f+p+Kta3TyIgGgXvyHHtL Oum55jfrB6FE2psyFyENJ+3gbR/wno5MRXK79hNfxJAu4pBbYQLrFvzddLAazB0m GGZDyPuAj11GAC/m5mW+3Y69w4XS85iDm2C0bCzEHSaEe7kv2joBc487SVfU/UiW 86pCsptPnnUnmfgfyS5WIOy5iI70RlBnyl/NOa9lyxQMPkCVv/zA8N74SZTC9bA= =IJGz -----END PGP SIGNATURE----- --WtVhKil0IaKNtG8era6Eao9jtgamS6t6W--