]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Remove SafeFreePool from MemoryAllocationLib as this API's name is misleading. Its...
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 30 Oct 2008 08:00:56 +0000 (08:00 +0000)
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 30 Oct 2008 08:00:56 +0000 (08:00 +0000)
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

EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c
EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Forms.c
EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c
EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c
EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Strings.c
EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrDefault.c
EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrParser.c
EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrParserExpression.c

index 0955d7faff532063a4b6b2a29753db67d419cbcf..0e4125450f8d5e7b5dd24e93ec02065ab5a30218 100644 (file)
@@ -508,7 +508,9 @@ ThunkExtractConfig (
                                             );\r
   }\r
 \r
-  SafeFreePool (Data);\r
+  if (Data != NULL) {\r
+    FreePool (Data);\r
+  }\r
   return Status;\r
 }\r
 \r
index 02beec331f391a56e5667f73c54605564e62fc08..6616526e950b94435a362b29857cc210110ea2da 100644 (file)
@@ -558,8 +558,10 @@ HiiUpdateForm (
 \r
 Done:\r
   if (UefiHiiUpdateData != NULL) {\r
-    SafeFreePool (UefiHiiUpdateData->Data);\r
-    SafeFreePool (UefiHiiUpdateData);\r
+    if (UefiHiiUpdateData->Data != NULL) {\r
+      FreePool (UefiHiiUpdateData->Data);\r
+    }\r
+    FreePool (UefiHiiUpdateData);\r
   }\r
 \r
   mInFrameworkUpdatePakcage = FALSE; \r
index 845a9f72e0c84918f3a48edafe08ec2d4a50a1d9..c6b30cb85ae4aef9424670f72a9bfd3e0b7a5706 100644 (file)
@@ -408,7 +408,9 @@ Returns:
 \r
 Done:\r
   FreePool (LangCodes3066);\r
-  SafeFreePool (LangCodes639);\r
+  if (LangCodes639 != NULL) {\r
+    FreePool (LangCodes639);\r
+  }\r
 \r
   return Status;\r
 }\r
@@ -491,11 +493,18 @@ Returns:
   *LanguageString = AsciiStrToUnicodeStr (SecLangCodes639, UnicodeSecLangCodes639);\r
 \r
 Done:\r
-  \r
-  SafeFreePool (PrimaryLang639);\r
-  SafeFreePool (SecLangCodes639);\r
-  SafeFreePool (SecLangCodes3066);\r
-  SafeFreePool (UnicodeSecLangCodes639);\r
+  if (PrimaryLang639 != NULL) {\r
+    FreePool (PrimaryLang639);\r
+  }\r
+  if (SecLangCodes639 != NULL) {\r
+    FreePool (SecLangCodes639);\r
+  }\r
+  if (SecLangCodes3066 != NULL) {\r
+    FreePool (SecLangCodes3066);\r
+  }\r
+  if (UnicodeSecLangCodes639 != NULL) {\r
+    FreePool (UnicodeSecLangCodes639);\r
+  }\r
   \r
   return Status;\r
 }\r
index 5f2aa18b845feec3b8fbfa59c399ed747d9ef1da..d87b2a28d16d787125b792742a31dbf5898b6be4 100644 (file)
@@ -322,7 +322,7 @@ UefiRegisterPackageList(
               &ThunkContext->UefiHiiHandle\r
               );\r
   if (Status == EFI_INVALID_PARAMETER) {\r
-    SafeFreePool (PackageListHeader);\r
+    FreePool (PackageListHeader);\r
     \r
     //\r
     // UEFI HII database does not allow two package list with the same GUID.\r
@@ -386,7 +386,9 @@ Done:
     *Handle = ThunkContext->FwHiiHandle;\r
   }\r
 \r
-  SafeFreePool (PackageListHeader);\r
+       if (PackageListHeader != NULL) {\r
+    FreePool (PackageListHeader);\r
+  }\r
   \r
   return Status;\r
 }\r
index c648e1da1a2203d102b0ccc9a4978b240cc87001..5c499392fe272eea8e7af271a5b0dcee3d2a20d2 100644 (file)
@@ -378,7 +378,9 @@ Returns:
   }\r
 \r
 Done:\r
-  SafeFreePool (Iso639AsciiLanguage);\r
+       if (Iso639AsciiLanguage != NULL) {\r
+    FreePool (Iso639AsciiLanguage);\r
+  }\r
   \r
   return Status;\r
 }\r
index 4c382d4eeff58e4356c351bf5d7373228eb4a1e7..f799dc664a305210a45d55abd3cbfffaf7407a9a 100644 (file)
@@ -462,9 +462,9 @@ DestroyDefaultNode (
   IN UEFI_IFR_BUFFER_STORAGE_NODE        *Node\r
   )\r
 {\r
-  SafeFreePool (Node->Buffer);\r
-  SafeFreePool (Node->Name);\r
-  SafeFreePool (Node);\r
+  FreePool (Node->Buffer);\r
+  FreePool (Node->Name);\r
+  FreePool (Node);\r
 }\r
 \r
 \r
index 8870128ad2cc976b04cf184b09c924f609f89d49..8b130af45fdbdceb942615764b18e8493738e0a7 100644 (file)
@@ -386,7 +386,9 @@ DestroyExpression (
     OpCode = EXPRESSION_OPCODE_FROM_LINK (Link);\r
     RemoveEntryList (&OpCode->Link);\r
 \r
-    SafeFreePool (OpCode->ValueList);\r
+    if (OpCode->ValueList != NULL) {\r
+      FreePool (OpCode->ValueList);\r
+    }\r
   }\r
 \r
   //\r
@@ -416,25 +418,25 @@ DestroyStorage (
     return;\r
   }\r
 \r
-  SafeFreePool (Storage->Name);\r
-  SafeFreePool (Storage->Buffer);\r
-  SafeFreePool (Storage->EditBuffer);\r
+  FreePool (Storage->Name);\r
+  FreePool (Storage->Buffer);\r
+  FreePool (Storage->EditBuffer);\r
 \r
   while (!IsListEmpty (&Storage->NameValueListHead)) {\r
     Link = GetFirstNode (&Storage->NameValueListHead);\r
     NameValueNode = NAME_VALUE_NODE_FROM_LINK (Link);\r
     RemoveEntryList (&NameValueNode->Link);\r
 \r
-    SafeFreePool (NameValueNode->Name);\r
-    SafeFreePool (NameValueNode->Value);\r
-    SafeFreePool (NameValueNode->EditValue);\r
-    SafeFreePool (NameValueNode);\r
+    FreePool (NameValueNode->Name);\r
+    FreePool (NameValueNode->Value);\r
+    FreePool (NameValueNode->EditValue);\r
+    FreePool (NameValueNode);\r
   }\r
 \r
-  SafeFreePool (Storage->ConfigHdr);\r
-  SafeFreePool (Storage->ConfigRequest);\r
+  FreePool (Storage->ConfigHdr);\r
+  FreePool (Storage->ConfigRequest);\r
 \r
-  gBS->FreePool (Storage);\r
+  FreePool (Storage);\r
 }\r
 \r
 \r
@@ -500,11 +502,16 @@ DestroyStatement (
     DestroyExpression (Expression);\r
   }\r
 \r
-  SafeFreePool (Statement->VariableName);\r
-  SafeFreePool (Statement->BlockName);\r
+  if (Statement->VariableName != NULL) {\r
+    FreePool (Statement->VariableName);\r
+  }\r
+  if (Statement->BlockName != NULL) {\r
+    FreePool (Statement->BlockName);\r
+  }\r
 }\r
 \r
 \r
+\r
 /**\r
   Free resources of a Form\r
 \r
@@ -572,7 +579,7 @@ DestroyFormSet (
   //\r
   // Free IFR binary buffer\r
   //\r
-  SafeFreePool (FormSet->IfrBinaryData);\r
+  FreePool (FormSet->IfrBinaryData);\r
 \r
   //\r
   // Free FormSet Storage\r
@@ -613,10 +620,14 @@ DestroyFormSet (
     }\r
   }\r
 \r
-  SafeFreePool (FormSet->StatementBuffer);\r
-  SafeFreePool (FormSet->ExpressionBuffer);\r
+  if (FormSet->StatementBuffer != NULL) {\r
+    FreePool (FormSet->StatementBuffer);\r
+  }\r
+  if (FormSet->ExpressionBuffer != NULL) {\r
+    FreePool (FormSet->ExpressionBuffer);\r
+  }\r
 \r
-  SafeFreePool (FormSet);\r
+  FreePool (FormSet);\r
 }\r
 \r
 \r
index caeb576336b9460df71bdb3aac336963e3ced8dc..1fc398fed222fe9b25a98335ebd4fd5af61a51a5 100644 (file)
@@ -732,9 +732,15 @@ IfrCatenate (
   Result->Value.string = NewString (StringPtr, FormSet->HiiHandle);\r
 \r
 Done:\r
-  SafeFreePool (String[0]);\r
-  SafeFreePool (String[1]);\r
-  SafeFreePool (StringPtr);\r
+  if (String[0] != NULL) {\r
+    FreePool (String[0]);\r
+  }\r
+  if (String[1] != NULL) {\r
+    FreePool (String[1]);\r
+  }  \r
+  if (StringPtr != NULL) {\r
+    FreePool (StringPtr);\r
+  }\r
 \r
   return Status;\r
 }\r
@@ -790,8 +796,12 @@ IfrMatch (
   Result->Value.b = mUnicodeCollation->MetaiMatch (mUnicodeCollation, String[0], String[1]);\r
 \r
 Done:\r
-  SafeFreePool (String[0]);\r
-  SafeFreePool (String[1]);\r
+  if (String[0] != NULL) {\r
+    FreePool (String[0]);\r
+  }\r
+  if (String[1] != NULL) {\r
+    FreePool (String[1]);\r
+  }  \r
 \r
   return Status;\r
 }\r
@@ -875,8 +885,12 @@ IfrFind (
   }\r
 \r
 Done:\r
-  SafeFreePool (String[0]);\r
-  SafeFreePool (String[1]);\r
+  if (String[0] != NULL) {\r
+    FreePool (String[0]);\r
+  }\r
+  if (String[1] != NULL) {\r
+    FreePool (String[1]);\r
+  }  \r
 \r
   return Status;\r
 }\r
@@ -1045,8 +1059,12 @@ IfrToken (
   Result->Value.string = NewString (SubString, FormSet->HiiHandle);\r
 \r
 Done:\r
-  SafeFreePool (String[0]);\r
-  SafeFreePool (String[1]);\r
+  if (String[0] != NULL) {\r
+    FreePool (String[0]);\r
+  }\r
+  if (String[1] != NULL) {\r
+    FreePool (String[1]);\r
+  }  \r
 \r
   return Status;\r
 }\r
@@ -1149,8 +1167,12 @@ IfrSpan (
   Result->Value.u64 = StringPtr - String[1];\r
 \r
 Done:\r
-  SafeFreePool (String[0]);\r
-  SafeFreePool (String[1]);\r
+  if (String[0] != NULL) {\r
+    FreePool (String[0]);\r
+  }\r
+  if (String[1] != NULL) {\r
+    FreePool (String[1]);\r
+  }  \r
 \r
   return Status;\r
 }\r