libxl: avoid double free of b_info->u.pv.bootloader
PATCH v2 1/1 libxl: avoid double free of b_info->u.pv.bootloader
# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1337335831 -3600
# Node ID 894f39993bdc96aaaf2ad0115af2f5e83d9cc1b1 # Parent 0e1d32df5b8d8bdbf88b6cd4a6b18fc008258373
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.
---
v2: use libxl__strdup(NULL, ...) to get the expected error handling.
tools/libxl/libxl_bootloader.c +4 -2
@@ -356,8 +356,10 @@ void libxl__bootloader_run(libxl__egc *eif (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);
Quoted 7 lines · Ian Campbell
# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1337335831 -3600
# Node ID894f39993bdc96aaaf2ad0115af2f5e83d9cc1b1# Parent0e1d32df5b8d8bdbf88b6cd4a6b18fc008258373
libxl: avoid double free ofb_info->u.pv.bootloader.
Quoted 5 lines
b_infois a user provided struct and therefore the content must come from malloc and not gc such thatlibxl_domain_build_info_disposecan free it. This was broken by 25340:373f24c87dee.Signed-off-by Ian Campbell <[email protected]>
Ian Jackson acked this out of band and I have therefore applied it.
Quoted 24 lines
---
v2: uselibxl__strdup(NULL, ...)to get the expected error handling.diff -r
0e1d32df5b8d-r894f39993bdctools/libxl/libxl_bootloader.ctools/libxl/libxl_bootloader.c +4
-2@@ -356,8 +356,10 @@ void libxl__bootloader_run(libxl__egc *eif (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-devel mailing list
[email protected]
http://lists.xen.org/xen-devel