mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 13:11:31 +00:00
efi_loader: memory leak in efi_set_bootdev()
efi_set_bootdev() may be called repeatedly. Free the memory allocated for device paths in previous calls. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
8887acc685
commit
79276eb243
1 changed files with 7 additions and 0 deletions
|
@ -603,6 +603,13 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path)
|
|||
char filename[32] = { 0 }; /* dp->str is u16[32] long */
|
||||
char *s;
|
||||
|
||||
/* efi_set_bootdev is typically called repeatedly, recover memory */
|
||||
efi_free_pool(bootefi_device_path);
|
||||
efi_free_pool(bootefi_image_path);
|
||||
/* If blk_get_device_part_str fails, avoid duplicate free. */
|
||||
bootefi_device_path = NULL;
|
||||
bootefi_image_path = NULL;
|
||||
|
||||
if (strcmp(dev, "Net")) {
|
||||
struct blk_desc *desc;
|
||||
disk_partition_t fs_partition;
|
||||
|
|
Loading…
Add table
Reference in a new issue