[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 08/13 v4] libxl: don't leak ptr in libxl_list_vm error case



Matthew Daley writes ("Re: [PATCH 08/13 v4] libxl: don't leak ptr in 
libxl_list_vm error case"):
> On Tue, Dec 3, 2013 at 1:08 AM, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> wrote:
> >> +    ptr = calloc(ret ? ret : 1, sizeof(libxl_vminfo));
> >
> > I think this should be a call to libxl__calloc, which cannot fail.
> 
> That adds the returned pointer to the GC, and since libxl_list_vm is
> part of the public libxl interface, I don't think that would be an
> acceptable change?

That's what NOGC is for.  You pass it to libxl__calloc et al, instead
of gc.

> > You still need to prat about with the ?: though I'm afraid.
> 
> You mean, you require the use of "a ?: b" over "a ? a : b"?

I mean only that libxl__calloc has the same unfortunate semantics as
calloc, when the size is zero, so you need to keep your existing ? :.
I agree that use of "a ?: b" in this case is a bad thing so please
don't change that.

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.