]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
Remove SafeFreePool from MemoryAllocationLib as this API's name is misleading. Its...
[mirror_edk2.git] / MdeModulePkg / Universal / HiiDatabaseDxe / Font.c
index a9d9571f836a0501118a8898bed7e0216ece1748..06b09e7f7625185baedfb912bad3987f26c85c70 100644 (file)
@@ -1024,7 +1024,9 @@ IsSystemFontInfo (
 \r
 Exit:\r
   if (SystemInfo == NULL) {\r
-    SafeFreePool (SystemDefault);    \r
+    if (SystemDefault != NULL) {\r
+      FreePool (SystemDefault);\r
+    }\r
   }\r
   return Flag;\r
 }\r
@@ -1646,7 +1648,9 @@ HiiStringToImage (
     Status = GetGlyphBuffer (Private, *StringPtr, FontInfo, &GlyphBuf[Index], &Cell[Index], &Attributes[Index]);\r
     if (Status == EFI_NOT_FOUND) {\r
       if ((Flags & EFI_HII_IGNORE_IF_NO_GLYPH) == EFI_HII_IGNORE_IF_NO_GLYPH) {\r
-        SafeFreePool (GlyphBuf[Index]);\r
+        if (GlyphBuf[Index] != NULL) {\r
+          FreePool (GlyphBuf[Index]);\r
+        }\r
         GlyphBuf[Index] = NULL;\r
         StringPtr++;\r
       } else {\r
@@ -1871,11 +1875,11 @@ HiiStringToImage (
                                         0\r
                                         );\r
         if (EFI_ERROR (Status)) {\r
-          SafeFreePool (BltBuffer);\r
+          FreePool (BltBuffer);\r
           goto Exit;\r
         }\r
 \r
-        SafeFreePool (BltBuffer);\r
+        FreePool (BltBuffer);\r
 \r
       } else {\r
         for (Index1 = RowInfo[RowIndex].StartIndex; Index1 <= RowInfo[RowIndex].EndIndex; Index1++) {\r
@@ -1938,7 +1942,7 @@ HiiStringToImage (
     Image->Height = 600;\r
     Image->Image.Bitmap = AllocateZeroPool (Image->Width * Image->Height *sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
     if (Image->Image.Bitmap == NULL) {\r
-      SafeFreePool (Image);\r
+      FreePool (Image);\r
       return EFI_OUT_OF_RESOURCES;\r
     }\r
 \r
@@ -1970,16 +1974,34 @@ HiiStringToImage (
 Exit:\r
 \r
   for (Index = 0; Index < MAX_STRING_LENGTH; Index++) {\r
-    SafeFreePool (GlyphBuf[Index]);\r
+    if (GlyphBuf[Index] != NULL) {\r
+      FreePool (GlyphBuf[Index]);\r
+    }\r
+  }\r
+  if (StringIn != NULL) {\r
+    FreePool (StringIn);\r
+  }\r
+  if (StringIn2 != NULL) {\r
+    FreePool (StringIn2);\r
+  }\r
+  if (StringInfoOut != NULL) {\r
+    FreePool (StringInfoOut);\r
+  }\r
+  if (RowInfo != NULL) {\r
+    FreePool (RowInfo);\r
+  }\r
+  if (SystemDefault != NULL) {\r
+    FreePool (SystemDefault);\r
+  }\r
+  if (GlyphBuf != NULL) {\r
+    FreePool (GlyphBuf);\r
+  }\r
+  if (Cell != NULL) {\r
+    FreePool (Cell);\r
+  }\r
+  if (Attributes != NULL) {\r
+    FreePool (Attributes);\r
   }\r
-  SafeFreePool (StringIn);\r
-  SafeFreePool (StringIn2);\r
-  SafeFreePool (StringInfoOut);\r
-  SafeFreePool (RowInfo);\r
-  SafeFreePool (SystemDefault);\r
-  SafeFreePool (GlyphBuf);\r
-  SafeFreePool (Cell);\r
-  SafeFreePool (Attributes);\r
 \r
   return Status;\r
 }\r
@@ -2113,7 +2135,7 @@ HiiStringIdToImage (
                                 &StringFontInfo\r
                                 );\r
   if (Status == EFI_BUFFER_TOO_SMALL) {\r
-    SafeFreePool (String);\r
+    FreePool (String);\r
     String = (EFI_STRING) AllocateZeroPool (StringSize);\r
     if (String == NULL) {\r
       return EFI_OUT_OF_RESOURCES;\r
@@ -2180,9 +2202,15 @@ HiiStringIdToImage (
            );\r
 \r
 Exit:\r
-  SafeFreePool (String);\r
-  SafeFreePool (StringFontInfo);\r
-  SafeFreePool (NewStringInfo);\r
+  if (String != NULL) {\r
+    FreePool (String);\r
+  }\r
+  if (StringFontInfo != NULL) {\r
+    FreePool (StringFontInfo);\r
+  }\r
+  if (NewStringInfo != NULL) {\r
+    FreePool (NewStringInfo);\r
+  }\r
 \r
   return Status;\r
 }\r
@@ -2296,7 +2324,7 @@ HiiGetGlyph (
 \r
   Image->Image.Bitmap = AllocateZeroPool (Image->Width * Image->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
   if (Image->Image.Bitmap == NULL) {\r
-    SafeFreePool (Image);\r
+    FreePool (Image);\r
     Status = EFI_OUT_OF_RESOURCES;\r
     goto Exit;\r
   }\r
@@ -2337,10 +2365,18 @@ Exit:
     }\r
   }\r
 \r
-  SafeFreePool (SystemDefault);\r
-  SafeFreePool (StringInfoOut);\r
-  SafeFreePool (String);\r
-  SafeFreePool (GlyphBuffer);\r
+  if (SystemDefault != NULL) {\r
+   FreePool (SystemDefault);\r
+  }\r
+  if (StringInfoOut != NULL) {\r
+    FreePool (StringInfoOut);\r
+  }\r
+  if (String != NULL) {\r
+    FreePool (String);\r
+  }\r
+  if (GlyphBuffer != NULL) {\r
+    FreePool (GlyphBuffer);\r
+  }\r
 \r
   return Status;\r
 }\r
@@ -2539,8 +2575,12 @@ Exit:
     *FontHandle = LocalFontHandle;\r
   }\r
 \r
-  SafeFreePool (SystemDefault);\r
-  SafeFreePool (FontInfo);\r
+  if (SystemDefault != NULL) {\r
+   FreePool (SystemDefault);\r
+  }\r
+  if (FontInfo != NULL) {\r
+   FreePool (FontInfo);\r
+  }\r
   return Status;\r
 }\r
 \r