WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] add missing libxl__free_all() calls

To: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] add missing libxl__free_all() calls
From: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Date: Thu, 9 Dec 2010 14:12:06 +0000
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 09 Dec 2010 06:13:43 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <9ada9b410270be89e4e9.1291902672@nehalem1>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <9ada9b410270be89e4e9.1291902672@nehalem1>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Thu, 2010-12-09 at 13:51 +0000, Juergen Gross wrote:
> @@ -3760,8 +3772,10 @@ int libxl_destroy_cpupool(libxl_ctx *ctx
>      libxl_cpumap cpumap;
>  
>      info = xc_cpupool_getinfo(ctx->xch, poolid);
> -    if (info == NULL)
> -        return ERROR_NOMEM;
> +    if (info == NULL) {
> +        libxl__free_all(&gc);
> +        return ERROR_NOMEM;
> +    }

This one is un-necessary but harmless. The INIT_GC macro just zeros the
structure and allocates nothing. It might not be wise to rely on
programmer knowing that about the implementation in the long run...

>      rc = ERROR_INVAL;
>      if ((info->cpupool_id != poolid) || (info->n_dom))
> @@ -3805,6 +3819,7 @@ out1:
>      libxl_cpumap_destroy(&cpumap);
>  out:
>      xc_cpupool_infofree(ctx->xch, info);
> +    libxl__free_all(&gc);
>  
>      return rc;
>  }
> @@ -3963,6 +3978,7 @@ int libxl_cpupool_movedomain(libxl_ctx *
>  
>      dom_path = libxl__xs_get_dompath(&gc, domid);
>      if (!dom_path) {
> +        libxl__free_all(&gc);
>          return ERROR_FAIL;
>      }

Same again.

All the others are correct, most of them obviously so just from the diff
context, making them good catches. Nice work.

Gianni


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>