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@6307 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -408,7 +408,9 @@ Returns:
|
||||
|
||||
Done:
|
||||
FreePool (LangCodes3066);
|
||||
SafeFreePool (LangCodes639);
|
||||
if (LangCodes639 != NULL) {
|
||||
FreePool (LangCodes639);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
@@ -491,11 +493,18 @@ Returns:
|
||||
*LanguageString = AsciiStrToUnicodeStr (SecLangCodes639, UnicodeSecLangCodes639);
|
||||
|
||||
Done:
|
||||
|
||||
SafeFreePool (PrimaryLang639);
|
||||
SafeFreePool (SecLangCodes639);
|
||||
SafeFreePool (SecLangCodes3066);
|
||||
SafeFreePool (UnicodeSecLangCodes639);
|
||||
if (PrimaryLang639 != NULL) {
|
||||
FreePool (PrimaryLang639);
|
||||
}
|
||||
if (SecLangCodes639 != NULL) {
|
||||
FreePool (SecLangCodes639);
|
||||
}
|
||||
if (SecLangCodes3066 != NULL) {
|
||||
FreePool (SecLangCodes3066);
|
||||
}
|
||||
if (UnicodeSecLangCodes639 != NULL) {
|
||||
FreePool (UnicodeSecLangCodes639);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
Reference in New Issue
Block a user