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

Re: [Xen-devel] [PATCH for-4.6 02/13] libxl: properly clean up array in libxl_list_cpupool failure path

On Thu, 2015-07-23 at 08:59 +0100, Wei Liu wrote:
> Document how cpupool_info works.  Distinguish success (ERROR_FAIL +
> ENOENT) vs failure in libxl_list_cpupool and properly clean up the 
> array
> in failure path.
> Also switch to libxl__realloc and call libxl_cpupool_{init,dispose}
> where appropriate.
> There is change of behaviour. Previously if memory allocation fails 
> the
> said function returns NULL. Now memory allocation failure is fatal. 
> This
> is in line with how we deal with memory allocation failure in other
> places in libxl though.

I think this function would benefit from making the out: label be the
error path and the success case just a return ptr (just before the

Then your error handling for cpupool_info would become
            if (errno != ENOENT) goto out;

and the "if (failed)" block would be at the out label (without the

Such splitting of the success/failure case is allowed if the only
shared code would be the GC_FREE, which is the case here.


Xen-devel mailing list



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