Fix potential memory leak issue.

Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13458 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lzeng14 2012-06-18 01:34:27 +00:00
parent a7a8363d86
commit d69a7bc712
1 changed files with 3 additions and 2 deletions

View File

@ -101,14 +101,15 @@ FpdtStatusCodeListenerSmm (
// Try to allocate big SMRAM data to store Boot record.
//
if (mSmramIsOutOfResource) {
ReleaseSpinLock (&mSmmFpdtLock);
return EFI_OUT_OF_RESOURCES;
}
NewRecordBuffer = AllocatePool (mBootRecordSize + Data->Size + EXTENSION_RECORD_SIZE);
NewRecordBuffer = ReallocatePool (mBootRecordSize, mBootRecordSize + Data->Size + EXTENSION_RECORD_SIZE, mBootRecordBuffer);
if (NewRecordBuffer == NULL) {
ReleaseSpinLock (&mSmmFpdtLock);
mSmramIsOutOfResource = TRUE;
return EFI_OUT_OF_RESOURCES;
}
CopyMem (NewRecordBuffer, mBootRecordBuffer, mBootRecordSize);
mBootRecordBuffer = NewRecordBuffer;
mBootRecordMaxSize = mBootRecordSize + Data->Size + EXTENSION_RECORD_SIZE;
}