summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/HiiDatabaseDxe
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal/HiiDatabaseDxe')
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c126
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/Database.c135
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/Font.c90
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/Image.c39
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/String.c20
5 files changed, 255 insertions, 155 deletions
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
index 59c2b15..aed93be 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
@@ -127,13 +127,13 @@ GetDevicePath (
Length /= 2;
*DevicePath = (UINT8 *) AllocateZeroPool (Length);
if (*DevicePath == NULL) {
- SafeFreePool (DevicePathString);
+ FreePool (DevicePathString);
return EFI_OUT_OF_RESOURCES;
}
HexStringToBufInReverseOrder (*DevicePath, &Length, DevicePathString);
- SafeFreePool (DevicePathString);
+ FreePool (DevicePathString);
return EFI_SUCCESS;
@@ -202,7 +202,9 @@ ExportAllStorage (
);
}
if (EFI_ERROR (Status)) {
- SafeFreePool (HandleBuffer);
+ if (HandleBuffer != NULL) {
+ FreePool (HandleBuffer);
+ }
return Status;
}
@@ -219,8 +221,8 @@ ExportAllStorage (
Status = HiiExportPackageLists (HiiDatabase, HiiHandle, &BufferSize, HiiPackageList);
}
if (EFI_ERROR (Status)) {
- SafeFreePool (HandleBuffer);
- SafeFreePool (HiiPackageList);
+ FreePool (HandleBuffer);
+ FreePool (HiiPackageList);
return Status;
}
@@ -270,9 +272,9 @@ ExportAllStorage (
Status = HiiGetPackageListHandle (HiiDatabase, HiiHandle, &DriverHandle);
if (EFI_ERROR (Status)) {
- SafeFreePool (HandleBuffer);
- SafeFreePool (HiiPackageList);
- SafeFreePool (Storage);
+ FreePool (HandleBuffer);
+ FreePool (HiiPackageList);
+ FreePool (Storage);
return Status;
}
Storage->DriverHandle = DriverHandle;
@@ -305,10 +307,10 @@ ExportAllStorage (
}
}
- SafeFreePool (HiiPackageList);
+ FreePool (HiiPackageList);
}
- SafeFreePool (HandleBuffer);
+ FreePool (HandleBuffer);
return EFI_SUCCESS;
}
@@ -603,7 +605,9 @@ GetValueOfNumber (
Status = EFI_SUCCESS;
Exit:
- SafeFreePool (Str);
+ if (Str != NULL) {
+ FreePool (Str);
+ }
return Status;
}
@@ -738,7 +742,7 @@ HiiConfigRoutingExtractConfig (
//
Status = GetDevicePath (ConfigRequest, (UINT8 **) &DevicePath);
if (EFI_ERROR (Status)) {
- SafeFreePool (ConfigRequest);
+ FreePool (ConfigRequest);
return Status;
}
@@ -765,7 +769,7 @@ HiiConfigRoutingExtractConfig (
}
}
- SafeFreePool (DevicePath);
+ FreePool (DevicePath);
if (DriverHandle == NULL) {
//
@@ -773,7 +777,7 @@ HiiConfigRoutingExtractConfig (
// Set Progress to the 'G' in "GUID" of the routing header.
//
*Progress = StringPtr;
- SafeFreePool (ConfigRequest);
+ FreePool (ConfigRequest);
return EFI_NOT_FOUND;
}
@@ -802,7 +806,7 @@ HiiConfigRoutingExtractConfig (
for (TmpPtr = StringPtr; CompareMem (TmpPtr, AccessProgress, RemainSize) != 0; TmpPtr++);
*Progress = TmpPtr;
- SafeFreePool (ConfigRequest);
+ FreePool (ConfigRequest);
return Status;
}
@@ -812,9 +816,9 @@ HiiConfigRoutingExtractConfig (
ASSERT (*AccessProgress == 0);
Status = AppendToMultiString (Results, AccessResults);
ASSERT_EFI_ERROR (Status);
- SafeFreePool (AccessResults);
+ FreePool (AccessResults);
AccessResults = NULL;
- SafeFreePool (ConfigRequest);
+ FreePool (ConfigRequest);
ConfigRequest = NULL;
//
@@ -951,7 +955,7 @@ HiiConfigRoutingExportConfig (
ConfigRequest = (EFI_STRING) AllocateZeroPool (RequestSize);
if (ConfigRequest == NULL) {
- SafeFreePool (PathHdr);
+ FreePool (PathHdr);
return EFI_OUT_OF_RESOURCES;
}
@@ -997,7 +1001,7 @@ HiiConfigRoutingExportConfig (
StringPtr += StrLen (L"PATH=");
StrCpy (StringPtr, PathHdr);
- SafeFreePool (PathHdr);
+ FreePool (PathHdr);
PathHdr = NULL;
//
@@ -1021,6 +1025,8 @@ HiiConfigRoutingExportConfig (
);
ASSERT_EFI_ERROR (Status);
+ AccessProgress = NULL;
+ AccessResults = NULL;
Status = ConfigAccess->ExtractConfig (
ConfigAccess,
ConfigRequest,
@@ -1028,8 +1034,13 @@ HiiConfigRoutingExportConfig (
&AccessResults
);
if (EFI_ERROR (Status)) {
- SafeFreePool (ConfigRequest);
- SafeFreePool (AccessResults);
+ FreePool (ConfigRequest);
+ if (AccessProgress != NULL) {
+ FreePool (AccessProgress);
+ }
+ if (AccessResults != NULL) {
+ FreePool (AccessResults);
+ }
return EFI_INVALID_PARAMETER;
}
@@ -1039,9 +1050,9 @@ HiiConfigRoutingExportConfig (
ASSERT (*AccessProgress == 0);
Status = AppendToMultiString (Results, AccessResults);
ASSERT_EFI_ERROR (Status);
- SafeFreePool (AccessResults);
+ FreePool (AccessResults);
AccessResults = NULL;
- SafeFreePool (ConfigRequest);
+ FreePool (ConfigRequest);
ConfigRequest = NULL;
}
@@ -1057,8 +1068,8 @@ HiiConfigRoutingExportConfig (
HII_FORMSET_STORAGE_SIGNATURE
);
RemoveEntryList (&Storage->Entry);
- SafeFreePool (Storage->Name);
- SafeFreePool (Storage);
+ FreePool (Storage->Name);
+ FreePool (Storage);
}
return EFI_SUCCESS;
@@ -1173,7 +1184,7 @@ HiiConfigRoutingRouteConfig (
//
Status = GetDevicePath (ConfigResp, (UINT8 **) &DevicePath);
if (EFI_ERROR (Status)) {
- SafeFreePool (ConfigResp);
+ FreePool (ConfigResp);
return Status;
}
@@ -1200,7 +1211,7 @@ HiiConfigRoutingRouteConfig (
}
}
- SafeFreePool (DevicePath);
+ FreePool (DevicePath);
if (DriverHandle == NULL) {
//
@@ -1208,7 +1219,7 @@ HiiConfigRoutingRouteConfig (
// Set Progress to the 'G' in "GUID" of the routing header.
//
*Progress = StringPtr;
- SafeFreePool (ConfigResp);
+ FreePool (ConfigResp);
return EFI_NOT_FOUND;
}
@@ -1237,11 +1248,11 @@ HiiConfigRoutingRouteConfig (
for (TmpPtr = StringPtr; CompareMem (TmpPtr, AccessProgress, RemainSize) != 0; TmpPtr++);
*Progress = TmpPtr;
- SafeFreePool (ConfigResp);
+ FreePool (ConfigResp);
return Status;
}
- SafeFreePool (ConfigResp);
+ FreePool (ConfigResp);
ConfigResp = NULL;
//
@@ -1408,7 +1419,7 @@ HiiBlockToConfig (
TmpBuffer,
(((Length + 1) / 2) < sizeof (UINTN)) ? ((Length + 1) / 2) : sizeof (UINTN)
);
- SafeFreePool (TmpBuffer);
+ FreePool (TmpBuffer);
StringPtr += Length;
if (StrnCmp (StringPtr, L"&WIDTH=", StrLen (L"&WIDTH=")) != 0) {
@@ -1432,7 +1443,7 @@ HiiBlockToConfig (
TmpBuffer,
(((Length + 1) / 2) < sizeof (UINTN)) ? ((Length + 1) / 2) : sizeof (UINTN)
);
- SafeFreePool (TmpBuffer);
+ FreePool (TmpBuffer);
StringPtr += Length;
if (*StringPtr != 0 && *StringPtr != L'&') {
@@ -1471,7 +1482,7 @@ HiiBlockToConfig (
ASSERT_EFI_ERROR (Status);
ToLower (ValueStr);
- SafeFreePool (Value);
+ FreePool (Value);
Value = NULL;
//
@@ -1493,8 +1504,8 @@ HiiBlockToConfig (
AppendToMultiString (Config, ConfigElement);
- SafeFreePool (ConfigElement);
- SafeFreePool (ValueStr);
+ FreePool (ConfigElement);
+ FreePool (ValueStr);
ConfigElement = NULL;
ValueStr = NULL;
@@ -1519,11 +1530,16 @@ HiiBlockToConfig (
return EFI_SUCCESS;
Exit:
-
- SafeFreePool (*Config);
- SafeFreePool (ValueStr);
- SafeFreePool (Value);
- SafeFreePool (ConfigElement);
+ FreePool (*Config);
+ if (ValueStr != NULL) {
+ FreePool (ValueStr);
+ }
+ if (Value != NULL) {
+ FreePool (Value);
+ }
+ if (ConfigElement) {
+ FreePool (ConfigElement);
+ }
return Status;
@@ -1658,7 +1674,7 @@ HiiConfigToBlock (
TmpBuffer,
(((Length + 1) / 2) < sizeof (UINTN)) ? ((Length + 1) / 2) : sizeof (UINTN)
);
- SafeFreePool (TmpBuffer);
+ FreePool (TmpBuffer);
StringPtr += Length;
if (StrnCmp (StringPtr, L"&WIDTH=", StrLen (L"&WIDTH=")) != 0) {
@@ -1682,7 +1698,7 @@ HiiConfigToBlock (
TmpBuffer,
(((Length + 1) / 2) < sizeof (UINTN)) ? ((Length + 1) / 2) : sizeof (UINTN)
);
- SafeFreePool (TmpBuffer);
+ FreePool (TmpBuffer);
StringPtr += Length;
if (StrnCmp (StringPtr, L"&VALUE=", StrLen (L"&VALUE=")) != 0) {
@@ -1719,7 +1735,7 @@ HiiConfigToBlock (
CopyMem (Block + Offset, Value, Width);
*BlockSize = Offset + Width - 1;
- SafeFreePool (Value);
+ FreePool (Value);
Value = NULL;
//
@@ -1743,7 +1759,9 @@ HiiConfigToBlock (
Exit:
- SafeFreePool (Value);
+ if (Value != NULL) {
+ FreePool (Value);
+ }
return Status;
}
@@ -1983,11 +2001,21 @@ Exit:
}
}
- SafeFreePool (GuidStr);
- SafeFreePool (NameStr);
- SafeFreePool (PathStr);
- SafeFreePool (AltIdStr);
- SafeFreePool (Result);
+ if (GuidStr != NULL) {
+ FreePool (GuidStr);
+ }
+ if (NameStr != NULL) {
+ FreePool (NameStr);
+ }
+ if (PathStr != NULL) {
+ FreePool (PathStr);
+ }
+ if (AltIdStr != NULL) {
+ FreePool (AltIdStr);
+ }
+ if (Result != NULL) {
+ FreePool (Result);
+ }
return Status;
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
index 2a6ec0d..5a37dd0 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
@@ -58,7 +58,7 @@ GenerateHiiDatabaseRecord (
DatabaseRecord->PackageList = AllocateZeroPool (sizeof (HII_DATABASE_PACKAGE_LIST_INSTANCE));
if (DatabaseRecord->PackageList == NULL) {
- SafeFreePool (DatabaseRecord);
+ FreePool (DatabaseRecord);
return EFI_OUT_OF_RESOURCES;
}
@@ -78,8 +78,8 @@ GenerateHiiDatabaseRecord (
//
HiiHandle = (HII_HANDLE *) AllocateZeroPool (sizeof (HII_HANDLE));
if (HiiHandle == NULL) {
- SafeFreePool (DatabaseRecord->PackageList);
- SafeFreePool (DatabaseRecord);
+ FreePool (DatabaseRecord->PackageList);
+ FreePool (DatabaseRecord);
return EFI_OUT_OF_RESOURCES;
}
HiiHandle->Signature = HII_HANDLE_SIGNATURE;
@@ -340,8 +340,9 @@ InvokeRegisteredFunction (
}
}
- SafeFreePool (Buffer);
- Buffer = NULL;
+ if (Buffer != NULL) {
+ FreePool (Buffer);
+ }
return EFI_SUCCESS;
}
@@ -390,7 +391,7 @@ InsertGuidPackage (
}
GuidPackage->GuidPkg = (UINT8 *) AllocateZeroPool (PackageHeader.Length);
if (GuidPackage->GuidPkg == NULL) {
- SafeFreePool (GuidPackage);
+ FreePool (GuidPackage);
return EFI_OUT_OF_RESOURCES;
}
@@ -524,8 +525,8 @@ RemoveGuidPackages (
RemoveEntryList (&Package->GuidEntry);
CopyMem (&PackageHeader, Package->GuidPkg, sizeof (EFI_HII_PACKAGE_HEADER));
PackageList->PackageListHdr.PackageLength -= PackageHeader.Length;
- SafeFreePool (Package->GuidPkg);
- SafeFreePool (Package);
+ FreePool (Package->GuidPkg);
+ FreePool (Package);
}
return EFI_SUCCESS;
@@ -579,7 +580,7 @@ InsertFormPackage (
FormPackage->IfrData = (UINT8 *) AllocateZeroPool (PackageHeader.Length - sizeof (EFI_HII_PACKAGE_HEADER));
if (FormPackage->IfrData == NULL) {
- SafeFreePool (FormPackage);
+ FreePool (FormPackage);
return EFI_OUT_OF_RESOURCES;
}
@@ -738,8 +739,8 @@ RemoveFormPackages (
RemoveEntryList (&Package->IfrEntry);
PackageList->PackageListHdr.PackageLength -= Package->FormPkgHdr.Length;
- SafeFreePool (Package->IfrData);
- SafeFreePool (Package);
+ FreePool (Package->IfrData);
+ FreePool (Package);
}
@@ -809,11 +810,11 @@ InsertStringPackage (
for (Link = PackageList->StringPkgHdr.ForwardLink; Link != &PackageList->StringPkgHdr; Link = Link->ForwardLink) {
StringPackage = CR (Link, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE);
if (R8_EfiLibCompareLanguage (Language, StringPackage->StringPkgHdr->Language)) {
- SafeFreePool (Language);
+ FreePool (Language);
return EFI_UNSUPPORTED;
}
}
- SafeFreePool (Language);
+ FreePool (Language);
//
// Create a String package node
@@ -876,9 +877,15 @@ InsertStringPackage (
Error:
- SafeFreePool (StringPackage->StringBlock);
- SafeFreePool (StringPackage->StringPkgHdr);
- SafeFreePool (StringPackage);
+ if (StringPackage->StringBlock != NULL) {
+ FreePool (StringPackage->StringBlock);
+ }
+ if (StringPackage->StringPkgHdr != NULL) {
+ FreePool (StringPackage->StringPkgHdr);
+ }
+ if (StringPackage != NULL) {
+ FreePool (StringPackage);
+ }
return Status;
}
@@ -1014,8 +1021,8 @@ RemoveStringPackages (
RemoveEntryList (&Package->StringEntry);
PackageList->PackageListHdr.PackageLength -= Package->StringPkgHdr->Header.Length;
- SafeFreePool (Package->StringBlock);
- SafeFreePool (Package->StringPkgHdr);
+ FreePool (Package->StringBlock);
+ FreePool (Package->StringPkgHdr);
//
// Delete font information
//
@@ -1027,10 +1034,10 @@ RemoveStringPackages (
HII_FONT_INFO_SIGNATURE
);
RemoveEntryList (&FontInfo->Entry);
- SafeFreePool (FontInfo);
+ FreePool (FontInfo);
}
- SafeFreePool (Package);
+ FreePool (Package);
}
return EFI_SUCCESS;
@@ -1169,11 +1176,21 @@ InsertFontPackage (
Error:
- SafeFreePool (FontPkgHdr);
- SafeFreePool (FontInfo);
- SafeFreePool (FontPackage->GlyphBlock);
- SafeFreePool (FontPackage);
- SafeFreePool (GlobalFont);
+ if (FontPkgHdr != NULL) {
+ FreePool (FontPkgHdr);
+ }
+ if (FontInfo != NULL) {
+ FreePool (FontInfo);
+ }
+ if (FontPackage->GlyphBlock != NULL) {
+ FreePool (FontPackage->GlyphBlock);
+ }
+ if (FontPackage != NULL) {
+ FreePool (FontPackage);
+ }
+ if (GlobalFont != NULL) {
+ FreePool (GlobalFont);
+ }
return Status;
@@ -1313,8 +1330,11 @@ RemoveFontPackages (
RemoveEntryList (&Package->FontEntry);
PackageList->PackageListHdr.PackageLength -= Package->FontPkgHdr->Header.Length;
- SafeFreePool (Package->GlyphBlock);
- SafeFreePool (Package->FontPkgHdr);
+
+ if (Package->GlyphBlock != NULL) {
+ FreePool (Package->GlyphBlock);
+ }
+ FreePool (Package->FontPkgHdr);
//
// Delete default character cell information
//
@@ -1326,7 +1346,7 @@ RemoveFontPackages (
HII_GLYPH_INFO_SIGNATURE
);
RemoveEntryList (&GlyphInfo->Entry);
- SafeFreePool (GlyphInfo);
+ FreePool (GlyphInfo);
}
//
@@ -1336,13 +1356,13 @@ RemoveFontPackages (
GlobalFont = CR (Link, HII_GLOBAL_FONT_INFO, Entry, HII_GLOBAL_FONT_INFO_SIGNATURE);
if (GlobalFont->FontPackage == Package) {
RemoveEntryList (&GlobalFont->Entry);
- SafeFreePool (GlobalFont->FontInfo);
- SafeFreePool (GlobalFont);
+ FreePool (GlobalFont->FontInfo);
+ FreePool (GlobalFont);
break;
}
}
- SafeFreePool (Package);
+ FreePool (Package);
}
return EFI_SUCCESS;
@@ -1430,7 +1450,7 @@ InsertImagePackage (
ImagePackage->PaletteBlock = (UINT8 *) AllocateZeroPool (PaletteSize);
if (ImagePackage->PaletteBlock == NULL) {
- SafeFreePool (ImagePackage);
+ FreePool (ImagePackage);
return EFI_OUT_OF_RESOURCES;
}
CopyMem (
@@ -1450,8 +1470,8 @@ InsertImagePackage (
sizeof (EFI_HII_IMAGE_PACKAGE_HDR) - PaletteSize;
ImagePackage->ImageBlock = (UINT8 *) AllocateZeroPool (ImageSize);
if (ImagePackage->ImageBlock == NULL) {
- SafeFreePool (ImagePackage->PaletteBlock);
- SafeFreePool (ImagePackage);
+ FreePool (ImagePackage->PaletteBlock);
+ FreePool (ImagePackage);
return EFI_OUT_OF_RESOURCES;
}
CopyMem (
@@ -1611,9 +1631,11 @@ RemoveImagePackages (
PackageList->PackageListHdr.PackageLength -= Package->ImagePkgHdr.Header.Length;
- SafeFreePool (Package->ImageBlock);
- SafeFreePool (Package->PaletteBlock);
- SafeFreePool (Package);
+ FreePool (Package->ImageBlock);
+ if (Package->PaletteBlock != NULL) {
+ FreePool (Package->PaletteBlock);
+ }
+ FreePool (Package);
PackageList->ImagePkg = NULL;
@@ -1691,8 +1713,12 @@ InsertSimpleFontPackage (
Error:
- SafeFreePool (SimpleFontPackage->SimpleFontPkgHdr);
- SafeFreePool (SimpleFontPackage);
+ if (SimpleFontPackage->SimpleFontPkgHdr != NULL) {
+ FreePool (SimpleFontPackage->SimpleFontPkgHdr);
+ }
+ if (SimpleFontPackage != NULL) {
+ FreePool (SimpleFontPackage);
+ }
return Status;
}
@@ -1817,8 +1843,8 @@ RemoveSimpleFontPackages (
RemoveEntryList (&Package->SimpleFontEntry);
PackageList->PackageListHdr.PackageLength -= Package->SimpleFontPkgHdr->Header.Length;
- SafeFreePool (Package->SimpleFontPkgHdr);
- SafeFreePool (Package);
+ FreePool (Package->SimpleFontPkgHdr);
+ FreePool (Package);
}
return EFI_SUCCESS;
@@ -2003,7 +2029,7 @@ RemoveDevicePathPackage (
CopyMem (&Header, Package, sizeof (EFI_HII_PACKAGE_HEADER));
PackageList->PackageListHdr.PackageLength -= Header.Length;
- SafeFreePool (Package);
+ FreePool (Package);
PackageList->DevicePathPkg = NULL;
@@ -2132,8 +2158,12 @@ InsertKeyboardLayoutPackage (
Error:
- SafeFreePool (KeyboardLayoutPackage->KeyboardPkg);
- SafeFreePool (KeyboardLayoutPackage);
+ if (KeyboardLayoutPackage->KeyboardPkg != NULL) {
+ FreePool (KeyboardLayoutPackage->KeyboardPkg);
+ }
+ if (KeyboardLayoutPackage != NULL) {
+ FreePool (KeyboardLayoutPackage);
+ }
return Status;
}
@@ -2265,8 +2295,8 @@ RemoveKeyboardLayoutPackages (
RemoveEntryList (&Package->KeyboardEntry);
CopyMem (&PackageHeader, Package->KeyboardPkg, sizeof (EFI_HII_PACKAGE_HEADER));
PackageList->PackageListHdr.PackageLength -= PackageHeader.Length;
- SafeFreePool (Package->KeyboardPkg);
- SafeFreePool (Package);
+ FreePool (Package->KeyboardPkg);
+ FreePool (Package);
}
return EFI_SUCCESS;
@@ -2850,9 +2880,9 @@ HiiRemovePackageList (
ASSERT (Private->HiiHandleCount >= 0);
HiiHandle->Signature = 0;
- SafeFreePool (HiiHandle);
- SafeFreePool (Node->PackageList);
- SafeFreePool (Node);
+ FreePool (HiiHandle);
+ FreePool (Node->PackageList);
+ FreePool (Node);
return EFI_SUCCESS;
}
@@ -3387,8 +3417,7 @@ HiiUnregisterPackageNotify (
NULL
);
ASSERT_EFI_ERROR (Status);
- SafeFreePool (Notify);
- Notify = NULL;
+ FreePool (Notify);
return EFI_SUCCESS;
}
@@ -3670,7 +3699,9 @@ HiiSetKeyboardLayout (
// Backup current keyboard layout.
//
CopyMem (&Private->CurrentLayoutGuid, KeyGuid, sizeof (EFI_GUID));
- SafeFreePool(Private->CurrentLayout);
+ if (Private->CurrentLayout != NULL) {
+ FreePool(Private->CurrentLayout);
+ }
Private->CurrentLayout = KeyboardLayout;
//
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
index a9d9571..06b09e7 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
@@ -1024,7 +1024,9 @@ IsSystemFontInfo (
Exit:
if (SystemInfo == NULL) {
- SafeFreePool (SystemDefault);
+ if (SystemDefault != NULL) {
+ FreePool (SystemDefault);
+ }
}
return Flag;
}
@@ -1646,7 +1648,9 @@ HiiStringToImage (
Status = GetGlyphBuffer (Private, *StringPtr, FontInfo, &GlyphBuf[Index], &Cell[Index], &Attributes[Index]);
if (Status == EFI_NOT_FOUND) {
if ((Flags & EFI_HII_IGNORE_IF_NO_GLYPH) == EFI_HII_IGNORE_IF_NO_GLYPH) {
- SafeFreePool (GlyphBuf[Index]);
+ if (GlyphBuf[Index] != NULL) {
+ FreePool (GlyphBuf[Index]);
+ }
GlyphBuf[Index] = NULL;
StringPtr++;
} else {
@@ -1871,11 +1875,11 @@ HiiStringToImage (
0
);
if (EFI_ERROR (Status)) {
- SafeFreePool (BltBuffer);
+ FreePool (BltBuffer);
goto Exit;
}
- SafeFreePool (BltBuffer);
+ FreePool (BltBuffer);
} else {
for (Index1 = RowInfo[RowIndex].StartIndex; Index1 <= RowInfo[RowIndex].EndIndex; Index1++) {
@@ -1938,7 +1942,7 @@ HiiStringToImage (
Image->Height = 600;
Image->Image.Bitmap = AllocateZeroPool (Image->Width * Image->Height *sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
if (Image->Image.Bitmap == NULL) {
- SafeFreePool (Image);
+ FreePool (Image);
return EFI_OUT_OF_RESOURCES;
}
@@ -1970,16 +1974,34 @@ HiiStringToImage (
Exit:
for (Index = 0; Index < MAX_STRING_LENGTH; Index++) {
- SafeFreePool (GlyphBuf[Index]);
+ if (GlyphBuf[Index] != NULL) {
+ FreePool (GlyphBuf[Index]);
+ }
+ }
+ if (StringIn != NULL) {
+ FreePool (StringIn);
+ }
+ if (StringIn2 != NULL) {
+ FreePool (StringIn2);
+ }
+ if (StringInfoOut != NULL) {
+ FreePool (StringInfoOut);
+ }
+ if (RowInfo != NULL) {
+ FreePool (RowInfo);
+ }
+ if (SystemDefault != NULL) {
+ FreePool (SystemDefault);
+ }
+ if (GlyphBuf != NULL) {
+ FreePool (GlyphBuf);
+ }
+ if (Cell != NULL) {
+ FreePool (Cell);
+ }
+ if (Attributes != NULL) {
+ FreePool (Attributes);
}
- SafeFreePool (StringIn);
- SafeFreePool (StringIn2);
- SafeFreePool (StringInfoOut);
- SafeFreePool (RowInfo);
- SafeFreePool (SystemDefault);
- SafeFreePool (GlyphBuf);
- SafeFreePool (Cell);
- SafeFreePool (Attributes);
return Status;
}
@@ -2113,7 +2135,7 @@ HiiStringIdToImage (
&StringFontInfo
);
if (Status == EFI_BUFFER_TOO_SMALL) {
- SafeFreePool (String);
+ FreePool (String);
String = (EFI_STRING) AllocateZeroPool (StringSize);
if (String == NULL) {
return EFI_OUT_OF_RESOURCES;
@@ -2180,9 +2202,15 @@ HiiStringIdToImage (
);
Exit:
- SafeFreePool (String);
- SafeFreePool (StringFontInfo);
- SafeFreePool (NewStringInfo);
+ if (String != NULL) {
+ FreePool (String);
+ }
+ if (StringFontInfo != NULL) {
+ FreePool (StringFontInfo);
+ }
+ if (NewStringInfo != NULL) {
+ FreePool (NewStringInfo);
+ }
return Status;
}
@@ -2296,7 +2324,7 @@ HiiGetGlyph (
Image->Image.Bitmap = AllocateZeroPool (Image->Width * Image->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
if (Image->Image.Bitmap == NULL) {
- SafeFreePool (Image);
+ FreePool (Image);
Status = EFI_OUT_OF_RESOURCES;
goto Exit;
}
@@ -2337,10 +2365,18 @@ Exit:
}
}
- SafeFreePool (SystemDefault);
- SafeFreePool (StringInfoOut);
- SafeFreePool (String);
- SafeFreePool (GlyphBuffer);
+ if (SystemDefault != NULL) {
+ FreePool (SystemDefault);
+ }
+ if (StringInfoOut != NULL) {
+ FreePool (StringInfoOut);
+ }
+ if (String != NULL) {
+ FreePool (String);
+ }
+ if (GlyphBuffer != NULL) {
+ FreePool (GlyphBuffer);
+ }
return Status;
}
@@ -2539,8 +2575,12 @@ Exit:
*FontHandle = LocalFontHandle;
}
- SafeFreePool (SystemDefault);
- SafeFreePool (FontInfo);
+ if (SystemDefault != NULL) {
+ FreePool (SystemDefault);
+ }
+ if (FontInfo != NULL) {
+ FreePool (FontInfo);
+ }
return Status;
}
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
index e570913..dc543b8 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
@@ -288,7 +288,7 @@ Output1bitPixel (
ZeroMem (PaletteValue, sizeof (PaletteValue));
CopyRgbToGopPixel (&PaletteValue[0], &Palette->PaletteValue[0], 1);
CopyRgbToGopPixel (&PaletteValue[1], &Palette->PaletteValue[1], 1);
- SafeFreePool (Palette);
+ FreePool (Palette);
//
// Convert the pixel from one bit to corresponding color.
@@ -373,7 +373,7 @@ Output4bitPixel (
ZeroMem (PaletteValue, sizeof (PaletteValue));
CopyRgbToGopPixel (PaletteValue, Palette->PaletteValue, PaletteNum);
- SafeFreePool (Palette);
+ FreePool (Palette);
//
// Convert the pixel from 4 bit to corresponding color.
@@ -446,7 +446,7 @@ Output8bitPixel (
PaletteNum = (UINT16)(Palette->PaletteSize / sizeof (EFI_HII_RGB_PIXEL));
ZeroMem (PaletteValue, sizeof (PaletteValue));
CopyRgbToGopPixel (PaletteValue, Palette->PaletteValue, PaletteNum);
- SafeFreePool (Palette);
+ FreePool (Palette);
//
// Convert the pixel from 8 bits to corresponding color.
@@ -679,7 +679,7 @@ HiiNewImage (
ImagePackage->ImageBlock,
ImagePackage->ImageBlockSize - sizeof (EFI_HII_IIBT_END_BLOCK)
);
- SafeFreePool (ImagePackage->ImageBlock);
+ FreePool (ImagePackage->ImageBlock);
ImagePackage->ImageBlock = ImageBlock;
ImageBlock += ImagePackage->ImageBlockSize - sizeof (EFI_HII_IIBT_END_BLOCK);
//
@@ -687,8 +687,7 @@ HiiNewImage (
//
NewBlock = AllocateZeroPool (NewBlockSize);
if (NewBlock == NULL) {
- SafeFreePool (ImagePackage->ImageBlock);
- ImagePackage->ImageBlock = NULL;
+ FreePool (ImagePackage->ImageBlock);
return EFI_OUT_OF_RESOURCES;
}
NewBlockPtr = NewBlock;
@@ -735,7 +734,7 @@ HiiNewImage (
ImagePackage->ImageBlockSize = (UINT32) BlockSize;
ImagePackage->ImageBlock = (UINT8 *) AllocateZeroPool (BlockSize);
if (ImagePackage->ImageBlock == NULL) {
- SafeFreePool (ImagePackage);
+ FreePool (ImagePackage);
return EFI_OUT_OF_RESOURCES;
}
ImageBlock = ImagePackage->ImageBlock;
@@ -745,8 +744,8 @@ HiiNewImage (
//
NewBlock = AllocateZeroPool (NewBlockSize);
if (NewBlock == NULL) {
- SafeFreePool (ImagePackage->ImageBlock);
- SafeFreePool (ImagePackage);
+ FreePool (ImagePackage->ImageBlock);
+ FreePool (ImagePackage);
return EFI_OUT_OF_RESOURCES;
}
NewBlockPtr = NewBlock;
@@ -774,7 +773,7 @@ HiiNewImage (
CopyGopToRgbPixel ((EFI_HII_RGB_PIXEL *) NewBlock, ImageIn->Bitmap, ImageIn->Width * ImageIn->Height);
CopyMem (ImageBlock, NewBlockPtr, NewBlockSize);
- SafeFreePool (NewBlockPtr);
+ FreePool (NewBlockPtr);
//
// Append the block end
@@ -1156,7 +1155,7 @@ HiiSetImage (
BlockSize = ImagePackage->ImageBlockSize + NewBlockSize - OldBlockSize;
Block = (UINT8 *) AllocateZeroPool (BlockSize);
if (Block == NULL) {
- SafeFreePool (NewBlock);
+ FreePool (NewBlock);
return EFI_OUT_OF_RESOURCES;
}
@@ -1169,8 +1168,8 @@ HiiSetImage (
BlockPtr += NewBlockSize;
CopyMem (BlockPtr, ImageBlock + OldBlockSize, Part2Size);
- SafeFreePool (ImagePackage->ImageBlock);
- SafeFreePool (NewBlock);
+ FreePool (ImagePackage->ImageBlock);
+ FreePool (NewBlock);
ImagePackage->ImageBlock = Block;
ImagePackage->ImageBlockSize = BlockSize;
ImagePackage->ImagePkgHdr.Header.Length += NewBlockSize - OldBlockSize;
@@ -1366,7 +1365,7 @@ HiiDrawImage (
}
- SafeFreePool (BltBuffer);
+ FreePool (BltBuffer);
return Status;
} else {
@@ -1384,7 +1383,7 @@ HiiDrawImage (
ImageOut = (EFI_IMAGE_OUTPUT *) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));
if (ImageOut == NULL) {
- SafeFreePool (BltBuffer);
+ FreePool (BltBuffer);
return EFI_OUT_OF_RESOURCES;
}
ImageOut->Width = (UINT16) Width;
@@ -1397,14 +1396,14 @@ HiiDrawImage (
//
Status = GetSystemFont (Private, &FontInfo, NULL);
if (EFI_ERROR (Status)) {
- SafeFreePool (BltBuffer);
- SafeFreePool (ImageOut);
+ FreePool (BltBuffer);
+ FreePool (ImageOut);
return Status;
}
for (Index = 0; Index < Width * Height; Index++) {
BltBuffer[Index] = FontInfo->BackgroundColor;
}
- SafeFreePool (FontInfo);
+ FreePool (FontInfo);
//
// Draw the incoming image to the new created image.
@@ -1494,7 +1493,9 @@ HiiDrawImageId (
// Draw this image.
//
Status = HiiDrawImage (This, Flags, &Image, Blt, BltX, BltY);
- SafeFreePool (Image.Bitmap);
+ if (Image.Bitmap != NULL) {
+ FreePool (Image.Bitmap);
+ }
return Status;
}
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
index 57b887d..d4fcc97 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
@@ -511,7 +511,7 @@ FindStringBlock (
//
StringPackage->FontId++;
- SafeFreePool (FontInfo);
+ FreePool (FontInfo);
}
BlockSize += Ext2.Length;
@@ -814,7 +814,7 @@ SetStringWorker (
TmpSize
);
- SafeFreePool (StringPackage->StringBlock);
+ FreePool (StringPackage->StringBlock);
StringPackage->StringBlock = Block;
StringPackage->StringPkgHdr->Header.Length += (UINT32) (BlockSize - OldBlockSize);
break;
@@ -847,7 +847,7 @@ SetStringWorker (
OldBlockSize - (StringTextPtr - StringPackage->StringBlock) - StringSize
);
- SafeFreePool (StringPackage->StringBlock);
+ FreePool (StringPackage->StringBlock);
StringPackage->StringBlock = Block;
StringPackage->StringPkgHdr->Header.Length += (UINT32) (BlockSize - OldBlockSize);
break;
@@ -898,7 +898,7 @@ SetStringWorker (
CopyMem (BlockPtr, StringPackage->StringBlock, OldBlockSize);
- SafeFreePool (StringPackage->StringBlock);
+ FreePool (StringPackage->StringBlock);
StringPackage->StringBlock = Block;
StringPackage->StringPkgHdr->Header.Length += Ext2.Length;
@@ -1043,7 +1043,7 @@ HiiNewString (
HeaderSize = (UINT32) (AsciiStrSize ((CHAR8 *) Language) - 1 + sizeof (EFI_HII_STRING_PACKAGE_HDR));
StringPackage->StringPkgHdr = AllocateZeroPool (HeaderSize);
if (StringPackage->StringPkgHdr == NULL) {
- SafeFreePool (StringPackage);
+ FreePool (StringPackage);
return EFI_OUT_OF_RESOURCES;
}
StringPackage->StringPkgHdr->Header.Type = EFI_HII_PACKAGE_STRINGS;
@@ -1063,8 +1063,8 @@ HiiNewString (
BlockSize = Ucs2BlockSize + sizeof (EFI_HII_SIBT_END_BLOCK);
StringPackage->StringBlock = (UINT8 *) AllocateZeroPool (BlockSize);
if (StringPackage->StringBlock == NULL) {
- SafeFreePool (StringPackage->StringPkgHdr);
- SafeFreePool (StringPackage);
+ FreePool (StringPackage->StringPkgHdr);
+ FreePool (StringPackage);
return EFI_OUT_OF_RESOURCES;
}
@@ -1139,7 +1139,7 @@ HiiNewString (
// Append a EFI_HII_SIBT_END block to the end.
//
*BlockPtr = EFI_HII_SIBT_END;
- SafeFreePool (StringPackage->StringBlock);
+ FreePool (StringPackage->StringBlock);
StringPackage->StringBlock = StringBlock;
StringPackage->StringPkgHdr->Header.Length += Ucs2BlockSize;
PackageListNode->PackageListHdr.PackageLength += Ucs2BlockSize;
@@ -1180,7 +1180,7 @@ HiiNewString (
// Append a EFI_HII_SIBT_END block to the end.
//
*BlockPtr = EFI_HII_SIBT_END;
- SafeFreePool (StringPackage->StringBlock);
+ FreePool (StringPackage->StringBlock);
StringPackage->StringBlock = StringBlock;
StringPackage->StringPkgHdr->Header.Length += Ucs2FontBlockSize;
PackageListNode->PackageListHdr.PackageLength += Ucs2FontBlockSize;
@@ -1240,7 +1240,7 @@ HiiNewString (
// Append a EFI_HII_SIBT_END block to the end.
//
*BlockPtr = EFI_HII_SIBT_END;
- SafeFreePool (StringPackage->StringBlock);
+ FreePool (StringPackage->StringBlock);
StringPackage->StringBlock = StringBlock;
StringPackage->StringPkgHdr->Header.Length += FontBlockSize + Ucs2FontBlockSize;
PackageListNode->PackageListHdr.PackageLength += FontBlockSize + Ucs2FontBlockSize;