MdeModulePkg/HiiDatabaseDxe: Fix memory leak issues in HiiDatabaseDxe

Cc: Qiu Shumin <shumin.qiu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>
This commit is contained in:
Dandan Bi 2016-04-27 18:00:02 +08:00 committed by Star Zeng
parent fdd530d61b
commit a0b0cd7391
1 changed files with 20 additions and 1 deletions

View File

@ -549,6 +549,8 @@ FindSameBlockElement(
ASSERT (TempBuffer != NULL);
if ((BufferLen == Length) && (0 == CompareMem (Buffer, TempBuffer, Length))) {
*Found = TRUE;
FreePool (TempBuffer);
TempBuffer = NULL;
return EFI_SUCCESS;
} else {
FreePool (TempBuffer);
@ -1887,6 +1889,9 @@ IsThisPackageList (
if (IsThisVarstore((VOID *)&IfrVarStore->Guid, VarStoreName, ConfigHdr)) {
FindVarstore = TRUE;
goto Done;
} else {
FreePool (VarStoreName);
VarStoreName = NULL;
}
break;
@ -1901,6 +1906,9 @@ IsThisPackageList (
if (IsThisVarstore (&IfrEfiVarStore->Guid, VarStoreName, ConfigHdr)) {
FindVarstore = TRUE;
goto Done;
} else {
FreePool (VarStoreName);
VarStoreName = NULL;
}
break;
@ -2094,6 +2102,7 @@ ParseIfrData (
FirstOneOfOption = FALSE;
VarStoreId = 0;
FirstOrderedList = FALSE;
VarStoreName = NULL;
ZeroMem (&DefaultData, sizeof (IFR_DEFAULT_DATA));
//
@ -2151,6 +2160,9 @@ ParseIfrData (
VarStorageData->Name = VarStoreName;
VarStorageData->Type = EFI_HII_VARSTORE_BUFFER;
VarStoreId = IfrVarStore->VarStoreId;
} else {
FreePool (VarStoreName);
VarStoreName = NULL;
}
break;
@ -2189,6 +2201,9 @@ ParseIfrData (
VarStorageData->Name = VarStoreName;
VarStorageData->Type = EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER;
VarStoreId = IfrEfiVarStore->VarStoreId;
} else {
FreePool (VarStoreName);
VarStoreName = NULL;
}
break;
@ -3014,7 +3029,7 @@ GetBlockElement (
if (EFI_ERROR (Status)) {
goto Done;
}
FreePool (TmpBuffer);
StringPtr += Length;
if (*StringPtr != 0 && *StringPtr != L'&') {
goto Done;
@ -3868,6 +3883,10 @@ Done:
}
FreePool (BlockData);
}
if (VarStorageData ->Name != NULL) {
FreePool (VarStorageData ->Name);
VarStorageData ->Name = NULL;
}
FreePool (VarStorageData);
}