From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH] libxc: Fix CID 1351228 resource leak Date: Wed, 10 Feb 2016 10:32:51 +0100 Message-ID: <1455096771.3148.172.camel@citrix.com> References: <1455095385-3120-1-git-send-email-write.harmandeep@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5875937168388396538==" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aTR8s-000231-5T for xen-devel@lists.xenproject.org; Wed, 10 Feb 2016 09:32:58 +0000 In-Reply-To: <1455095385-3120-1-git-send-email-write.harmandeep@gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Harmandeep Kaur , xen-devel@lists.xenproject.org Cc: wei.liu2@citrix.com, ian.jackson@eu.citrix.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org --===============5875937168388396538== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-6yFivNjy+U7OuMQsZ0On" --=-6yFivNjy+U7OuMQsZ0On Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2016-02-10 at 14:39 +0530, Harmandeep Kaur wrote: > What I just said about the other patch ("libxc: Fix CID 1351225 resource leak") applies here as well, of course. :-) About the code... > --- a/tools/libxc/xc_tbuf.c > +++ b/tools/libxc/xc_tbuf.c > @@ -70,9 +70,13 @@ int xc_tbuf_get_size(xc_interface *xch, unsigned > long *size) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0sysctl.u.tbuf_op.buff= er_mfn); > =C2=A0 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if ( t_info =3D=3D NULL || t_info->tbuf_siz= e =3D=3D 0 ) > +=C2=A0=C2=A0=C2=A0=C2=A0{ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0xenforeignmemory_unmap(x= ch->fmem, t_info, 0); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return -1; > +=C2=A0=C2=A0=C2=A0=C2=A0} > =C2=A0 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0*size =3D t_info->tbuf_size; > +=C2=A0=C2=A0=C2=A0=C2=A0xenforeignmemory_unmap(xch->fmem, t_info, *size)= ; > =C2=A0 I think you can arrange for only calling the unmapping function once, i.e., put the unmap call in a place where (after a slight reorganization of the rest of the code as well) it can be common to both the success and error path. Regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-6yFivNjy+U7OuMQsZ0On Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEABECAAYFAla7A8MACgkQk4XaBE3IOsTxngCgqGJgR/zffbK23UL2JxTWei65 Cs4Anj4u0Qp0vuLHnYE7qefDn9cuBXEB =CVDb -----END PGP SIGNATURE----- --=-6yFivNjy+U7OuMQsZ0On-- --===============5875937168388396538== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============5875937168388396538==--