diff options
| author | Andrew Goodbody <[email protected]> | 2025-10-03 15:54:34 +0100 |
|---|---|---|
| committer | Heinrich Schuchardt <[email protected]> | 2025-10-18 11:41:31 +0200 |
| commit | 11a64138f5f3525c2b02059e316701c4f55714cb (patch) | |
| tree | 35c003e3ace9147ef50a3646c3b2801793620dcb /lib/efi_loader | |
| parent | bd87ec920d266a31fe716717682bf0bf541fa1e6 (diff) | |
efi_loader: Prevent leak of memory from tmp_files
After the malloc of tmp_files and before its value is recorded an early
exit will need to free tmp_files to prevent leaking that memory.
This issue was found by Smatch.
Signed-off-by: Andrew Goodbody <[email protected]>
Reviewed-by: Heinrich Schuchardt <[email protected]>
Diffstat (limited to 'lib/efi_loader')
| -rw-r--r-- | lib/efi_loader/efi_capsule.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index f19e78ae9d1..31b47a20186 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -1096,8 +1096,10 @@ static efi_status_t efi_capsule_scan_dir(u16 ***files, unsigned int *num) while (1) { tmp_size = dirent_size; ret = EFI_CALL((*dirh->read)(dirh, &tmp_size, dirent)); - if (ret != EFI_SUCCESS) + if (ret != EFI_SUCCESS) { + free(tmp_files); goto err; + } if (!tmp_size) break; |
