From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH 12/28] libxl: only free cputopology if it was allocated in libxl__get_numa_candidate Date: Wed, 18 Sep 2013 09:57:06 +0200 Message-ID: <1379491026.18543.41.camel@Abyss> References: <1379475484-25993-1-git-send-email-mattjd@gmail.com> <1379475484-25993-13-git-send-email-mattjd@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5407211793761892025==" Return-path: In-Reply-To: <1379475484-25993-13-git-send-email-mattjd@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: Matthew Daley Cc: Stefano Stabellini , Ian Jackson , Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org --===============5407211793761892025== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-rONKN8BKeYFlKBBb7m5b" --=-rONKN8BKeYFlKBBb7m5b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On mer, 2013-09-18 at 15:37 +1200, Matthew Daley wrote: > Coverity-ID: 1055293 > Signed-off-by: Matthew Daley > --- >=20 > diff --git a/tools/libxl/libxl_numa.c b/tools/libxl/libxl_numa.c > index 20c99ac..f9944e0 100644 > --- a/tools/libxl/libxl_numa.c > +++ b/tools/libxl/libxl_numa.c > @@ -495,7 +495,8 @@ int libxl__get_numa_candidate(libxl__gc *gc, > libxl_bitmap_dispose(&suitable_nodemap); > libxl__numa_candidate_dispose(&new_cndt); > libxl_numainfo_list_free(ninfo, nr_nodes); > - libxl_cputopology_list_free(tinfo, nr_cpus); > + if (tinfo !=3D NULL) > + libxl_cputopology_list_free(tinfo, nr_cpus); > I don't think this is necessary. Actually, although not wrong, it deviates from the usual exiting pattern: init everything at the beginning, free everything on the way out. libxl_cputopology_list_free() is well capable of dealing with a non-allocated tinfo, provided nr_cpus is 0 too. If I'm not mistaken, that is exactly the case, all the times that tinfo is NULL, since: - it is initialized to 0 in libxl__get_numa_candidate(); - its value is only altered, within libxl_get_cpu_topology(), in case=20 tinfo !=3D NULL So, really, I don't think we should apply this. Also, if something like that would be necessary, why doing it only for tinfo and not for ninfo as well? I'm not that into coverity, but I don't think I see why it treats the two of them differently... :-O Regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-rONKN8BKeYFlKBBb7m5b 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.4.14 (GNU/Linux) iEYEABECAAYFAlI5XNIACgkQk4XaBE3IOsTvsACeJyMrvyM3rssapXA/m28vHIa8 ukQAnA9aH4Nx4rSadm9C1NsUz56DUcKe =AVyi -----END PGP SIGNATURE----- --=-rONKN8BKeYFlKBBb7m5b-- --===============5407211793761892025== 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 --===============5407211793761892025==--