From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH] tools/libxl: Correct use of phyinfo_{init, dispose}() Date: Wed, 5 Aug 2015 09:40:34 +0100 Message-ID: <1438764034.9747.16.camel@citrix.com> References: <1438714718-23711-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1438714718-23711-1-git-send-email-andrew.cooper3@citrix.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: Andrew Cooper , Xen-devel Cc: Wei Liu , Ian Jackson List-Id: xen-devel@lists.xenproject.org On Tue, 2015-08-04 at 19:58 +0100, Andrew Cooper wrote: > Signed-off-by: Andrew Cooper > --- > CC: Ian Campbell > CC: Ian Jackson > CC: Wei Liu > > For my cpuid work which I have just started, I added an array to physinfo. > Coverity then frowned at me when it spotted all the memory leaks. > > Technically speaking, 4.6 isn't broken due to not having an allocation to free > in _dispose(), but this patch might still be worth taking in 4.6. We've tended to be rather lax about this for internal code when there is no actual work in the init/dispose functions in the current code base, so while this improvement is the sort of thing we should/would routinely except during development window I personally don't think it is worth a freeze exception. @@ -4653,6 +4654,8 @@ static int libxl__fill_dom0_memory_info(libxl__gc > *gc, uint32_t *target_memkb, > if (rc < 0) > goto out; > > + libxl_physinfo_dispose(&physinfo); > + libxl_physinfo_init(&physinfo); This pattern is starting to crop up a lot in loops of this type. I wonder if I should make the idl generate a libxl_FOO_reinit() which just == dispose+init? Ian.