summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-10-30 07:32:46 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-10-30 07:32:46 +0000
commit676df92c2c0c5bdeb0f8e27349f5dd467928ce09 (patch)
tree68999d69951d5884d39a206c5c81ba59d91157fb /MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
parentbb1d8ee66943c3d126abbfc007159eb0fe458927 (diff)
downloadedk2-platforms-676df92c2c0c5bdeb0f8e27349f5dd467928ce09.tar.xz
Remove SafeFreePool from MemoryAllocationLib as this API's name is misleading. Its implementation only check if a pointer is NULL. If a garbage pointer is passed in, the gBS->FreePool will still ASSERT in debug build and return error code.
It is recommended that module writer should keep track how a pointer is allocated and free it after use. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6306 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c')
-rw-r--r--MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
index a57265ebd2..6a0aad5716 100644
--- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
+++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
@@ -393,8 +393,8 @@ GraphicsConsoleControllerDriverStart (
PackageList = HiiLibPreparePackageList (1, &mFontPackageListGuid, Package);
Status = mHiiDatabase->NewPackageList (mHiiDatabase, PackageList, NULL, &(Private->HiiHandle));
ASSERT_EFI_ERROR (Status);
- SafeFreePool (PackageList);
- SafeFreePool (Package);
+ FreePool (PackageList);
+ FreePool (Package);
mFirstAccessFlag = FALSE;
}
@@ -1205,8 +1205,10 @@ GraphicsConsoleConOutTestString (
&Blt,
NULL
);
- SafeFreePool (Blt);
- Blt = NULL;
+ if (Blt != NULL) {
+ FreePool (Blt);
+ Blt = NULL;
+ }
Count++;
if (EFI_ERROR (Status)) {
@@ -1754,7 +1756,7 @@ DrawUnicodeWeightAtCursorN (
String = AllocateCopyPool ((Count + 1) * sizeof (CHAR16), UnicodeWeight);
if (String == NULL) {
- SafeFreePool (Blt);
+ FreePool (Blt);
return EFI_OUT_OF_RESOURCES;
}
//
@@ -1764,8 +1766,8 @@ DrawUnicodeWeightAtCursorN (
FontInfo = (EFI_FONT_DISPLAY_INFO *) AllocateZeroPool (sizeof (EFI_FONT_DISPLAY_INFO));
if (FontInfo == NULL) {
- SafeFreePool (Blt);
- SafeFreePool (String);
+ FreePool (Blt);
+ FreePool (String);
return EFI_OUT_OF_RESOURCES;
}
//
@@ -1803,8 +1805,8 @@ DrawUnicodeWeightAtCursorN (
Blt->Image.Bitmap = AllocateZeroPool (Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
if (Blt->Image.Bitmap == NULL) {
- SafeFreePool (Blt);
- SafeFreePool (String);
+ FreePool (Blt);
+ FreePool (String);
return EFI_OUT_OF_RESOURCES;
}
@@ -1847,15 +1849,21 @@ DrawUnicodeWeightAtCursorN (
);
}
- SafeFreePool (RowInfoArray);
- SafeFreePool (Blt->Image.Bitmap);
+ FreePool (RowInfoArray);
+ FreePool (Blt->Image.Bitmap);
} else {
Status = EFI_UNSUPPORTED;
}
- SafeFreePool (Blt);
- SafeFreePool (String);
- SafeFreePool (FontInfo);
+ if (Blt != NULL) {
+ FreePool (Blt);
+ }
+ if (String != NULL) {
+ FreePool (String);
+ }
+ if (FontInfo != NULL) {
+ FreePool (FontInfo);
+ }
return Status;
}