]> xenbits.xensource.com Git - people/vhanquez/xen-unstable.git/commitdiff
libxl: avoid double free of b_info->u.pv.bootloader
authorIan Campbell <ian.campbell@citrix.com>
Fri, 18 May 2012 12:39:59 +0000 (13:39 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 18 May 2012 12:39:59 +0000 (13:39 +0100)
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@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl_bootloader.c

index 81e9eab4cc5511dfd301e9ca0d541af731f86b10..ca8409cf98f248c7897eca3433d2abf583a5ae8c 100644 (file)
@@ -356,8 +356,10 @@ void libxl__bootloader_run(libxl__egc *egc, libxl__bootloader_state *bl)
         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 = libxl__strdup(NULL, bootloader);
+        }
     }
 
     make_bootloader_args(gc, bl);