diff --git a/ChangeLog b/ChangeLog index bda8fb46f..bdfa642ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-03-31 Vladimir Serbinenko + + * util/getroot.c (convert_system_partition_to_system_disk): Fix use + after free. + Reported by: Peter Jones. + 2012-03-31 Anton Blanchard * grub-core/fs/iso9660.c (grub_iso9660_iterate_dir): Do not byteswap diff --git a/util/getroot.c b/util/getroot.c index be055bc32..c9415efce 100644 --- a/util/getroot.c +++ b/util/getroot.c @@ -1892,13 +1892,16 @@ devmapper_out: if (! mapper_name) grub_dprintf ("hostdisk", "%s has no DM name\n", path); } + char *ret; + if (mapper_name) + ret = xasprintf ("/dev/mapper/%s", mapper_name); + else + ret = NULL; + if (tree) dm_tree_free (tree); free (path); - if (mapper_name) - return xasprintf ("/dev/mapper/%s", mapper_name); - else - return NULL; + return ret; } #endif /* HAVE_DEVICE_MAPPER */ }