From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Skeggs Subject: Re: [PATCH] drm/nouveau/iccsense: fix memory leak on default sensor->type case Date: Fri, 3 Jun 2016 08:28:27 +1000 Message-ID: <0d714853-4c6e-6fb2-0aa9-bac99642bd38@gmail.com> References: <1464863332-9610-1-git-send-email-colin.king@canonical.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1429827077==" Return-path: Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 932E56EC87 for ; Thu, 2 Jun 2016 22:26:18 +0000 (UTC) Received: by mail-pf0-x241.google.com with SMTP id f144so9427882pfa.2 for ; Thu, 02 Jun 2016 15:26:18 -0700 (PDT) Received: from [10.64.40.99] ([66.187.239.16]) by smtp.gmail.com with ESMTPSA id ke3sm640456pad.41.2016.06.02.15.26.13 for (version=TLSv1/SSLv3 cipher=OTHER); Thu, 02 Jun 2016 15:26:14 -0700 (PDT) In-Reply-To: <1464863332-9610-1-git-send-email-colin.king@canonical.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --===============1429827077== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Lg3o3QxUQNeRn7WAccReViDk26VafAxKf" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Lg3o3QxUQNeRn7WAccReViDk26VafAxKf Content-Type: multipart/mixed; boundary="QJ2deqdWW5orJa3GeN769WhmNjXWXcdQ4" From: Ben Skeggs To: dri-devel@lists.freedesktop.org Message-ID: <0d714853-4c6e-6fb2-0aa9-bac99642bd38@gmail.com> Subject: Re: [PATCH] drm/nouveau/iccsense: fix memory leak on default sensor->type case References: <1464863332-9610-1-git-send-email-colin.king@canonical.com> In-Reply-To: <1464863332-9610-1-git-send-email-colin.king@canonical.com> --QJ2deqdWW5orJa3GeN769WhmNjXWXcdQ4 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/02/2016 08:28 PM, Colin King wrote: > From: Colin Ian King >=20 > The default sensor->type case leaks memory allocated to rail. Fix > this by free'ing rail before we continue with the next loop iteration. This doesn't completely fix the issue, as there are continue statements in other sections of the code that can leak also. That said, I already have a patch fixing this issue in a branch I haven't pushed as of yet, I'll split it out later today. Thanks, Ben. >=20 > Signed-off-by: Colin Ian King > --- > drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c b/driv= ers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c > index 323c79a..79b0eb5 100644 > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c > @@ -305,6 +305,7 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev) > rail->read =3D nvkm_iccsense_ina3221_read; > break; > default: > + kfree(rail); > continue; > } > =20 >=20 --QJ2deqdWW5orJa3GeN769WhmNjXWXcdQ4-- --Lg3o3QxUQNeRn7WAccReViDk26VafAxKf 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 iQIcBAEBCAAGBQJXULMLAAoJEHYLnGJQkpH79gUQAK7b2VRn/Qdu4fB+/8GGjY+k dGZ0GUXC6zpbPgZkCdvgenGINXnKraYnOfDfEi/4VEs7wh9QrUy0/iZF/UoZotK8 6F9CQFdNcfRDdLlL23uSZhkr0eZm+1iDvL/MsgiugjCMkcEm5cB2hLL/7mrYFi0H aNUtDk/raA9eNEE87QiRWS+/mejzG8WzoTxHlHxQSi7u5nNFazztKi+vnidjJcGT cjxEXoB7dBxsMG9O3lfmJzs5cQJcteUxOkG+T4jt4uZC41l8pyhA5CcthsCgKvPa OK7s1Sy7kdGdwb8M4+WocJp4RyLZfp4mS3+39O47f4ZJmFK7mdtTfm4QGPdj7SUy tVu1o7QlJg/rpRw4XrDMRJwtilcwY40nSeh8uZ2L7ydqjWeIHd+4PbtYI/+CaPfe YLJseQXelWQWhDbCW8CIVGsL/cIz/7Z7AxXeNA2OQOX6lSNm+s2mp3CQLqfnbDJr sSqNPhxCnT7f8oIO5MxFXeMDIkNh2WJcqy7rxRAiYot/2PCfET+yJhksphELnH9K C10apdnwfsclZF+f72lsadr7LXY+JXluMgo4xDGnLkkly4hvW57G3SLKc+TgKDMy Zbv2Et4ip8xnhE6MwQOXrFir+YEiGz+YDqoGCzDxFF2CRpqDxrGAV6bXuIIQ5IHZ 5mGFiJeHJQcKdVFIaCxW =wTDQ -----END PGP SIGNATURE----- --Lg3o3QxUQNeRn7WAccReViDk26VafAxKf-- --===============1429827077== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============1429827077==--