mirror of https://github.com/acidanthera/audk.git
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:
parent
a7a8363d86
commit
d69a7bc712
|
@ -101,14 +101,15 @@ FpdtStatusCodeListenerSmm (
|
||||||
// Try to allocate big SMRAM data to store Boot record.
|
// Try to allocate big SMRAM data to store Boot record.
|
||||||
//
|
//
|
||||||
if (mSmramIsOutOfResource) {
|
if (mSmramIsOutOfResource) {
|
||||||
|
ReleaseSpinLock (&mSmmFpdtLock);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
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) {
|
if (NewRecordBuffer == NULL) {
|
||||||
|
ReleaseSpinLock (&mSmmFpdtLock);
|
||||||
mSmramIsOutOfResource = TRUE;
|
mSmramIsOutOfResource = TRUE;
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
CopyMem (NewRecordBuffer, mBootRecordBuffer, mBootRecordSize);
|
|
||||||
mBootRecordBuffer = NewRecordBuffer;
|
mBootRecordBuffer = NewRecordBuffer;
|
||||||
mBootRecordMaxSize = mBootRecordSize + Data->Size + EXTENSION_RECORD_SIZE;
|
mBootRecordMaxSize = mBootRecordSize + Data->Size + EXTENSION_RECORD_SIZE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue