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-changelog

[Xen-changelog] [xen-unstable] libxl: do not leak path to dom0 attached

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: do not leak path to dom0 attached disk after running bootloader
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 26 Aug 2010 03:31:13 -0700
Delivery-date: Thu, 26 Aug 2010 03:36:23 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1282670906 -3600
# Node ID d8af5a8bae8eea70a14e083fb2f306506ca85b7c
# Parent  d545371bc3adae551af6a80965da7024f0e1184b
libxl: do not leak path to dom0 attached disk after running bootloader

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl_bootloader.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff -r d545371bc3ad -r d8af5a8bae8e tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c    Tue Aug 24 18:26:08 2010 +0100
+++ b/tools/libxl/libxl_bootloader.c    Tue Aug 24 18:28:26 2010 +0100
@@ -33,7 +33,7 @@ static char **make_bootloader_args(libxl
 static char **make_bootloader_args(libxl_gc *gc,
                                    libxl_domain_build_info *info,
                                    uint32_t domid,
-                                   const char *fifo, const char *disk)
+                                   const char *fifo, char *disk)
 {
     flexarray_t *args;
     int nr = 0;
@@ -65,7 +65,7 @@ static char **make_bootloader_args(libxl
         } while ((t = strtok_r(NULL, " \t\n", &saveptr)));
     }
 
-    flexarray_set(args, nr++, strdup(disk));
+    flexarray_set(args, nr++, disk);
 
     /* Sentinal for execv */
     flexarray_set(args, nr++, NULL);
@@ -303,7 +303,7 @@ int libxl_run_bootloader(libxl_ctx *ctx,
     libxl_gc gc = LIBXL_INIT_GC(ctx);
     int ret, rc = 0;
     char *fifo = NULL;
-    const char *diskpath = NULL;
+    char *diskpath = NULL;
     char **args = NULL;
 
     char tempdir_template[] = "/var/run/libxl/bl.XXXXXX";
@@ -414,12 +414,14 @@ int libxl_run_bootloader(libxl_ctx *ctx,
         goto out_close;
     }
 
-    libxl_device_disk_local_detach(ctx, disk);
-
     parse_bootloader_result(ctx, info, blout);
 
     rc = 0;
 out_close:
+    if (diskpath) {
+        libxl_device_disk_local_detach(ctx, disk);
+        free(diskpath);
+    }
     if (fifo_fd > -1)
         close(fifo_fd);
     if (bootloader_fd > -1)

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxl: do not leak path to dom0 attached disk after running bootloader, Xen patchbot-unstable <=