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 3 of 6 RESENT] libxl: Allocate memory for strings

To: Marek Marczykowski <marmarek@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 3 of 6 RESENT] libxl: Allocate memory for strings in libxl_device_disk
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Mon, 6 Jun 2011 12:24:33 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 06 Jun 2011 04:26:10 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <9fe949c7ab9601bb5500.1307292633@devel14>
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>
Organization: Citrix Systems, Inc.
References: <patchbomb.1307292630@devel14> <9fe949c7ab9601bb5500.1307292633@devel14>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Sun, 2011-06-05 at 17:50 +0100, Marek Marczykowski wrote:
> # HG changeset patch
> # User Marek Marczykowski <marmarek@xxxxxxxxxxxx>
> # Date 1306962954 -7200
> # Node ID 9fe949c7ab9601bb5500a53c538f7a23b61e1bcb
> # Parent  5231fa19f3e39091ff29e2a6dca057ca54403092
> libxl: Allocate memory for strings in libxl_device_disk
> 
> Memory for strings in libxl_device_disk must be allocated from outside of
> libxl__gc to not be freed at the end of function (by libxl__free_all).
> 
> Fixes xl block-detach
> 
> Signed-off-by: Marek Marczykowski <marmarek@xxxxxxxxxxxx>

Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

> 
> diff -r 5231fa19f3e3 -r 9fe949c7ab96 tools/libxl/libxl_utils.c
> --- a/tools/libxl/libxl_utils.c       Wed Jun 01 23:15:29 2011 +0200
> +++ b/tools/libxl/libxl_utils.c       Wed Jun 01 23:15:54 2011 +0200
> @@ -551,10 +551,10 @@ int libxl_devid_to_device_disk(libxl_ctx
>          goto out;
>      disk->backend_domid = strtoul(val, NULL, 10);
>      be_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, 
> "%s/backend", diskpath));
> -    disk->pdev_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, 
> "%s/params", be_path));
> +    disk->pdev_path = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, 
> "%s/params", be_path), NULL);
>      val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/type", 
> be_path));
>      libxl_string_to_backend(ctx, val, &(disk->backend));
> -    disk->vdev = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/dev", 
> be_path));
> +    disk->vdev = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/dev", 
> be_path), NULL);
>      val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/removable", 
> be_path));
>      disk->unpluggable = !strcmp(val, "1");
>      val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mode", 
> be_path));
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



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

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