diff --git a/MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystem.c b/MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystem.c index 746f2ced70..fde2085947 100644 --- a/MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystem.c +++ b/MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystem.c @@ -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; } }