mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-17 18:34:42 +00:00
efi_loader: memory leak in efi_capsule_scan_dir()
If realloc() fails, we should free the old buffer.
Fixes: c74cd8bd08
: ("efi_loader: capsule: add capsule_on_disk support")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
parent
7d823747c6
commit
e8287b0fb2
1 changed files with 3 additions and 0 deletions
|
@ -756,8 +756,11 @@ static efi_status_t efi_capsule_scan_dir(u16 ***files, unsigned int *num)
|
|||
tmp_size = dirent_size;
|
||||
ret = EFI_CALL((*dirh->read)(dirh, &tmp_size, dirent));
|
||||
if (ret == EFI_BUFFER_TOO_SMALL) {
|
||||
struct efi_file_info *old_dirent = dirent;
|
||||
|
||||
dirent = realloc(dirent, tmp_size);
|
||||
if (!dirent) {
|
||||
dirent = old_dirent;
|
||||
ret = EFI_OUT_OF_RESOURCES;
|
||||
goto err;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue