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] libxl: Fix blktap2 for xl cset 21586:c3c2bcafe47

To: Daniel Stodden <daniel.stodden@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] libxl: Fix blktap2 for xl cset 21586:c3c2bcafe471
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Fri, 11 Jun 2010 11:38:38 +0100
Cc: Xen <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 11 Jun 2010 03:40:55 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <121121275eff812547ab.1276210314@xxxxxxxxxxxxxxxxxxxxxxx>
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: <121121275eff812547ab.1276210314@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
On Thu, 10 Jun 2010, Daniel Stodden wrote:
> libxl: Fix blktap2 for xl cset 21586:c3c2bcafe471.
> 
> Avoids a double free on automatic memory.
> 
> Signed-off-by: Daniel Stodden <daniel.stodden@xxxxxxxxxx>
> 
> diff -r 1bfab8704f32 -r 121121275eff tools/libxl/libxl.c
> --- a/tools/libxl/libxl.c     Thu Jun 10 10:18:00 2010 +0100
> +++ b/tools/libxl/libxl.c     Thu Jun 10 15:51:00 2010 -0700
> @@ -1253,13 +1253,15 @@
>  static char *make_blktap2_device(struct libxl_ctx *ctx,
>                                const char *name, const char *type)
>  {
> -    char *params, *devname;
> +    char *params, *devname = NULL, *rv = NULL;
>      int err;
>      params = libxl_sprintf(ctx, "%s:%s", type, name);
> -    devname = NULL;
>      err = tap_ctl_create(params, &devname);
> -    free(params);
> -    return err ? NULL : devname;
> +    if (!err) {
> +        rv = libxl_sprintf(ctx, devname);
> +        free(devname);
> +    }
> +    return rv;
>  }
>  
>  int libxl_device_disk_add(struct libxl_ctx *ctx, uint32_t domid, 
> libxl_device_disk *disk)


This code doesn't compile:

libxl_sprintf(ctx, devname);

In any case you can just use libxl_ptr_add to add a ptr to libxl memory
tracking.


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

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