From: Ian Campbell Date: Thu, 6 Nov 2014 13:00:31 +0000 (+0000) Subject: tools: libxl: do not leak diskpath during local disk attach X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~4103 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=379b351889a8f02abe30a06e2ce9ba8b381b91ab;p=xen.git 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 Signed-off-by: Ian Campbell Acked-by: Ian Jackson Acked-by: Wei Liu --- diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 7e7d1dff8f..f7961f608a 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -3030,7 +3030,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;