mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-29 08:01:08 +00:00
efi_loader: Do not leak memory when unlinking a mapping
As soon as a mapping is unlinked from the list, there are no further references to it, so it should be freed. If it not unlinked, update the start address and length. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
b6a9517275
commit
511d0b97ef
1 changed files with 5 additions and 2 deletions
|
@ -116,10 +116,13 @@ static int efi_mem_carve_out(struct efi_mem_list *map,
|
||||||
if (map_end == carve_end) {
|
if (map_end == carve_end) {
|
||||||
/* Full overlap, just remove map */
|
/* Full overlap, just remove map */
|
||||||
list_del(&map->link);
|
list_del(&map->link);
|
||||||
|
free(map);
|
||||||
|
} else {
|
||||||
|
map->desc.physical_start = carve_end;
|
||||||
|
map->desc.num_pages = (map_end - carve_end)
|
||||||
|
>> EFI_PAGE_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
map_desc->physical_start = carve_end;
|
|
||||||
map_desc->num_pages = (map_end - carve_end) >> EFI_PAGE_SHIFT;
|
|
||||||
return (carve_end - carve_start) >> EFI_PAGE_SHIFT;
|
return (carve_end - carve_start) >> EFI_PAGE_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue