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

[Xen-changelog] [xen-unstable] libxl: avoid double free of b_info->u.pv.bootloader


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Sat, 19 May 2012 14:22:07 +0000
  • Delivery-date: Sat, 19 May 2012 14:22:18 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1337344799 -3600
# Node ID 1c5994ce1533dc93f111c19c406069e48584350d
# Parent  e9058654ca08811b8928bf821e61e4f1a05f49e5
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>
Acked-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r e9058654ca08 -r 1c5994ce1533 tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c    Fri May 18 11:00:45 2012 +0100
+++ b/tools/libxl/libxl_bootloader.c    Fri May 18 13:39:59 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 = libxl__strdup(NULL, bootloader);
+        }
     }
 
     make_bootloader_args(gc, bl);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.