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
|