diff options
author | Stefan Brüns <stefan.bruens@rwth-aachen.de> | 2016-10-01 23:32:29 +0200 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2016-10-18 09:08:08 +0200 |
commit | 511d0b97ef709d13da4922fb694d55ef9a5ef641 (patch) | |
tree | 19fdb61edb3780ea70efa16b418fad2143dde9a2 /lib/efi_loader | |
parent | b6a951727504d4159467ac98434849f81aaf9ffa (diff) | |
download | u-boot-imx-511d0b97ef709d13da4922fb694d55ef9a5ef641.zip u-boot-imx-511d0b97ef709d13da4922fb694d55ef9a5ef641.tar.gz u-boot-imx-511d0b97ef709d13da4922fb694d55ef9a5ef641.tar.bz2 |
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>
Diffstat (limited to 'lib/efi_loader')
-rw-r--r-- | lib/efi_loader/efi_memory.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 742bc90..95aa590 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -116,10 +116,13 @@ static int efi_mem_carve_out(struct efi_mem_list *map, if (map_end == carve_end) { /* Full overlap, just remove map */ 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; } |