[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



On Tue, Dec 3, 2013 at 1:08 AM, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> wrote:
> Matthew Daley writes ("[PATCH 08/13 v4] libxl: don't leak ptr in 
> libxl_list_vm error case"):
>> While at it, tidy up the function; there's no point in allocating more
>> than the amount of domains actually returned by xc_domain_getinfolist
>> (unless 0 domains are returned, in which case we should still allocate
>> one libxl_vminfo struct so we can return a non-NULL result and not
>> appear to have failed from the caller's perspective.)
> ...
>> +    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?

>
> 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"?

- Matthew

_______________________________________________
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®.