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

[Xen-changelog] [xen stable-4.4] tools: libxl: do not leak diskpath during local disk attach



commit 30f10d4d2b102bd7184b84c9cc3d2246f060706a
Author:     Ian Campbell <ian.campbell@xxxxxxxxxx>
AuthorDate: Thu Nov 6 13:00:31 2014 +0000
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Mon Jan 12 15:41:14 2015 +0000

    tools: libxl: do not leak diskpath during local disk attach
    
    libxl__device_disk_local_initiate_attach is assigning dls->diskpath with a
    strdup of the device path. This is then passed to the callback, e.g.
    parse_bootloader_result but bootloader_cleanup will not free it.
    
    Since the callback is within the scope of the (e)gc and therefore doesn't 
need
    to be malloc'd, a gc'd alloc will do. All other assignments to this field 
use
    the gc.
    
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=767295
    
    Reported-by: Gedalya <gedalya@xxxxxxxxxxx>
    Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    (cherry picked from commit 379b351889a8f02abe30a06e2ce9ba8b381b91ab)
---
 tools/libxl/libxl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 0e41739..59e3292 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -2678,7 +2678,7 @@ void libxl__device_disk_local_initiate_attach(libxl__egc 
*egc,
     }
 
     if (dev != NULL)
-        dls->diskpath = strdup(dev);
+        dls->diskpath = libxl__strdup(gc, dev);
 
     dls->callback(egc, dls, 0);
     return;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.4

_______________________________________________
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®.