mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
MdeModulePkg FvSimpleFileSystemDxe: Fix memory leak in Read function
FvSimpleFileSystem on read always allocates a FileBuffer, and never frees it. This causes memory leaks. It is especially bad for reading scripts line-by-line. In some cases memory leak can exceed 1GB. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Vladimir Olovyannikiov <vladimir.olovyannikov@broadcom.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
parent
4a723ed258
commit
b5bd3ed648
@ -704,6 +704,7 @@ FvSimpleFileSystemRead (
|
||||
|
||||
Status = FvFsReadFile (File->Instance->FvProtocol, File->FvFileInfo, &FileSize, &FileBuffer);
|
||||
if (EFI_ERROR (Status)) {
|
||||
FreePool (FileBuffer);
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
@ -714,6 +715,8 @@ FvSimpleFileSystemRead (
|
||||
CopyMem (Buffer, (UINT8*)FileBuffer + File->Position, *BufferSize);
|
||||
File->Position += *BufferSize;
|
||||
|
||||
FreePool (FileBuffer);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user