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

[Xen-changelog] [xen-unstable] libxl: Fix blktap2 for xl cset 21586:c3c2bcafe471



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1276245325 -3600
# Node ID 630956366c2c992fa76f9a3e70c00c3f6ad3c39e
# Parent  a822156d9fbb706d25016bb3e067faac005254b4
libxl: Fix blktap2 for xl cset 21586:c3c2bcafe471

Avoids a double free on automatic memory.

Signed-off-by: Daniel Stodden <daniel.stodden@xxxxxxxxxx>
---
 tools/libxl/libxl.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff -r a822156d9fbb -r 630956366c2c tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Fri Jun 11 09:34:58 2010 +0100
+++ b/tools/libxl/libxl.c       Fri Jun 11 09:35:25 2010 +0100
@@ -1253,13 +1253,15 @@ static char *make_blktap2_device(struct 
 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)

_______________________________________________
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®.