From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v2] tools: libxl: make it illegal to pass libxl__realloc(gc) a non-gc ptr Date: Thu, 11 Feb 2016 15:38:50 +0000 Message-ID: <1455205130.814.71.camel@citrix.com> References: <1455182634-19386-1-git-send-email-ian.campbell@citrix.com> <20160211113712.GH17384@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20160211113712.GH17384@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: Wei Liu Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Thu, 2016-02-11 at 11:37 +0000, Wei Liu wrote: > On Thu, Feb 11, 2016 at 09:23:54AM +0000, Ian Campbell wrote: > > That is, if gc is not NOGC and ptr is not NULL then ptr must be > > associated gc. > > > > "associated with gc"? > > Anyway, I get the idea. Yeah, apparently I was having language issues yesterday (v1 had a different mangling elsewhere) > > Currently in this case the new_ptr would not be registered with any > > gc, which Coverity rightly points out (in various different places) > > would be a memory leak. > > > > It would also be possible to fix this by adding a libxl__ptr_add() at > > the same point, however semantically it seems like a programming error > > to gc-realloc a pointer which is not associated with the gc in > > question, so treat it as such. > > > > Compile tested only, this change could expose latent bugs. > > > > Signed-off-by: Ian Campbell > > Acked-by: Wei Liu Thanks. I corrected the above to "with a gc" and applied.