diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2010-08-24 18:28:26 +0100 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2010-08-24 18:28:26 +0100 |
commit | 86316089e4611c19d3b53c16f0ace532ef24a576 (patch) | |
tree | a2ea4e40dbcc849f981b17cfc77b44573e3a49a6 /tools/libxl/libxl_bootloader.c | |
parent | 3ebec8fa65cc13051997890f07fdcb8aab963d06 (diff) | |
download | xen-86316089e4611c19d3b53c16f0ace532ef24a576.tar.gz xen-86316089e4611c19d3b53c16f0ace532ef24a576.tar.bz2 xen-86316089e4611c19d3b53c16f0ace532ef24a576.zip |
libxl: do not leak path to dom0 attached disk after running bootloader
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl_bootloader.c')
-rw-r--r-- | tools/libxl/libxl_bootloader.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/libxl/libxl_bootloader.c b/tools/libxl/libxl_bootloader.c index 08d6a22274..13721f7fab 100644 --- a/tools/libxl/libxl_bootloader.c +++ b/tools/libxl/libxl_bootloader.c @@ -33,7 +33,7 @@ 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_gc *gc, } 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) |