[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] libxl: Allocate memory for strings in libxl_device_disk



# HG changeset patch
# User Marek Marczykowski <marmarek@xxxxxxxxxxxx>
# Date 1309191890 -3600
# Node ID 6656d80b4de4c8c5e04ef4c9569fbaf71bcb9e6e
# Parent  5c353f53c8e21e3c006e4ac759354a4b50e8e310
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>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r 5c353f53c8e2 -r 6656d80b4de4 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c Mon Jun 27 17:20:55 2011 +0100
+++ b/tools/libxl/libxl_utils.c Mon Jun 27 17:24:50 2011 +0100
@@ -551,10 +551,12 @@
         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->removable = !strcmp(val, "1");
     val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mode", 
be_path));

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.