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

[Xen-devel] [PATCH] libxl: avoid double free of b_info->u.pv.bootloader



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1337269191 -3600
# Node ID ac45608496cd85b0bf1aed6e5b869b4a86ca672f
# Parent  66359ac0c8d9046e0c033d428e0416884c612e33
libxl: avoid double free of b_info->u.pv.bootloader.

b_info is a user provided struct and therefore the content must come from
malloc and not gc such that libxl_domain_build_info_dispose can free it. This
was broken by 25340:373f24c87dee.

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

diff -r 66359ac0c8d9 -r ac45608496cd tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c    Thu May 17 16:39:40 2012 +0100
+++ b/tools/libxl/libxl_bootloader.c    Thu May 17 16:39:51 2012 +0100
@@ -356,8 +356,10 @@ void libxl__bootloader_run(libxl__egc *e
         if ( lstat(bootloader, &st) )
             LOG(DEBUG, "%s doesn't exist, falling back to config path",
                 bootloader);
-        else
-            info->u.pv.bootloader = bootloader;
+        else {
+            free(info->u.pv.bootloader);
+            info->u.pv.bootloader = strdup(bootloader);
+        }
     }
 
     make_bootloader_args(gc, bl);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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