Received: from eggs.gnu.org ([2001:4830:134:3::10]:45299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCpdc-0004Zb-3Q for qemu-devel@nongnu.org; Thu, 31 Jul 2014 08:39:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCpdS-0006gr-Us for qemu-devel@nongnu.org; Thu, 31 Jul 2014 08:39:16 -0400 Received: from mail-we0-x22f.google.com ([2a00:1450:400c:c03::22f]:37882) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCpdS-0006gg-Nw for qemu-devel@nongnu.org; Thu, 31 Jul 2014 08:39:06 -0400 Received: by mail-we0-f175.google.com with SMTP id t60so2685526wes.34 for ; Thu, 31 Jul 2014 05:39:05 -0700 (PDT) Date: Thu, 31 Jul 2014 13:39:02 +0100 From: Stefan Hajnoczi Message-ID: <20140731123902.GX25929@stefanha-thinkpad.redhat.com> References: <1404757089-4836-1-git-send-email-jsnow@redhat.com> <1404757089-4836-22-git-send-email-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="rG8Oha4Ryswg1dZ8" Content-Disposition: inline In-Reply-To: <1404757089-4836-22-git-send-email-jsnow@redhat.com> Subject: Re: [Qemu-devel] [PATCH 21/28] libqtest: Correct small memory leak. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, mst@redhat.com --rG8Oha4Ryswg1dZ8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 07, 2014 at 02:18:02PM -0400, John Snow wrote: > Fixes a small memory leak inside of libqtest. > After we produce a test path and glib copies the string > for itself, we should clean up our temporary copy. >=20 > Signed-off-by: John Snow > --- > tests/libqtest.c | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/tests/libqtest.c b/tests/libqtest.c > index e525e6f..8205e0a 100644 > --- a/tests/libqtest.c > +++ b/tests/libqtest.c > @@ -644,6 +644,7 @@ void qtest_add_func(const char *str, void (*fn)) > { > gchar *path =3D g_strdup_printf("/%s/%s", qtest_get_arch(), str); > g_test_add_func(path, fn); > + free(path); Glib functions use g_malloc()/g_free(), not malloc()/free(). Since this string was allocated with g_strdup_printf() it must be freed with g_free(). --rG8Oha4Ryswg1dZ8 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJT2jjmAAoJEJykq7OBq3PIdx0IAKS1p2L8KYYnv//mkIbRpAS8 Me8OFB0FgnJw9jsHLdXKhsN6q4WsOfnpnSqtpnUT2tjG3a5Vl77JEdSDUdj+zWzD zCmAQeHDi0ViCsVlcm+NryZqGTM95utT+dPgOgvZJc4Goq3kxLtt4+gkU0h83pQp p52uaueN4demJrIYhn1FLrSIvBcassJIiDDuSVAnS7kCIT20M/tm6GYNRcVdp6Os pjxVsbQSi6EfuoGMgUbD806wDCbLHD9iQXM6J+FXEQfdHys+Cw5gB7uuIns1UQQZ fctb6v4pwLvRO6gDXLo6u28V14QZ1S5KOYvadLUWfYswAoDeJBg9AlFnVcHvr+Q= =vBvq -----END PGP SIGNATURE----- --rG8Oha4Ryswg1dZ8--