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

Re: [Xen-devel] [PATCH 5/9] libxl: avoid leaking string in cpupool_info



On Fri, 2015-07-10 at 19:00 +0100, Wei Liu wrote:
> Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>

Would an "if (rc) libxl_cpupoolinfo_dispose(info)" on the exit path be a
more robust alternative? Might require the addition of a
libxl_cpupoolinfo_init() somewhere before any possible error.

> ---
>  tools/libxl/libxl.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index 38aff8d..4151dcb 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -740,8 +740,10 @@ static int cpupool_info(libxl__gc *gc,
>      info->sched = xcinfo->sched_id;
>      info->n_dom = xcinfo->n_dom;
>      rc = libxl_cpu_bitmap_alloc(CTX, &info->cpumap, 0);
> -    if (rc)
> +    if (rc) {
> +        free(info->pool_name);
>          goto out;
> +    }
>  
>      memcpy(info->cpumap.map, xcinfo->cpumap, info->cpumap.size);
>  



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