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
This commit is contained in:
qwang12
2008-10-30 07:32:46 +00:00
parent bb1d8ee669
commit 676df92c2c
27 changed files with 652 additions and 410 deletions

View File

@@ -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;
}