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 V5] libxl: make libxl communicate with xenstored

On Fri, 2010-09-17 at 15:12 +0100, Jun Zhu (Intern) wrote:
> Sorry. The V5 version has one place conflicting with another patch. I will 
> make a new one soon.
> 
> Jun Zhu
> Citrix Systems UK
> ________________________________________
> From: Jun Zhu (Intern)
> Sent: 17 September 2010 10:02
> To: Ian Campbell
> Cc: Ian Jackson; xen-devel@xxxxxxxxxxxxxxxxxxx
> Subject: RE: [Xen-devel] [PATCH V5] libxl: make libxl communicate with 
> xenstored by socket or xenbus driver
> 
> This version adds gc as a parameter to libxl__xs_open, and uses 
> LIBXL__LOG_ERRNO for logging. If some functions cannot use the ctx, It should 
> transfer NULL to libxl__xs_open to disable logging. (But it will make users 
> difficult to find the problem when no logging is output.)
> To make consistent with other functions in libxl__xshelp.c, I use gc as its 
> parameter, not ctx. In the libxl_ctx_init function, I add “libxl__gc gc = 
> LIBXL_INIT_GC(ctx)” to get the gc of ctx. Please check this.
> 
> Signed-off-by: Jun Zhu <Jun.Zhu@xxxxxxxxxx>
> 
> diff -r cca905a429aa tools/libxl/libxl.c
> --- a/tools/libxl/libxl.c       Tue Sep 14 15:39:36 2010 +0100
> +++ b/tools/libxl/libxl.c       Fri Sep 17 14:58:50 2010 +0100
> @@ -40,6 +40,8 @@
> 
>  int libxl_ctx_init(libxl_ctx *ctx, int version, xentoollog_logger *lg)
>  {
> +    libxl__gc gc = LIBXL_INIT_GC(ctx);
> +
>      if (version != LIBXL_VERSION)
>          return ERROR_VERSION;
>      memset(ctx, 0, sizeof(libxl_ctx));
> @@ -53,12 +55,8 @@
  +        libxl__free_all(&gc);
>          return ERROR_FAIL;
>      }

This leaks memory in success and both failure paths. That to be fixed in
next patch too I hope? :)


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