]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add check for memory allocation.
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 29 Jun 2009 07:29:39 +0000 (07:29 +0000)
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 29 Jun 2009 07:29:39 +0000 (07:29 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8678 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c

index 1c2192a11dd04ad21be5afc9581d5a511f08a8c4..ac29009c7448d1502c26954ac9e8c0909ec65e0a 100644 (file)
@@ -491,11 +491,15 @@ ReportStatusCodeEx (
   ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));\r
   ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));\r
 \r
+  if (gBS == NULL || gBS->AllocatePool == NULL || gBS->FreePool == NULL) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
   //\r
   // Allocate space for the Status Code Header and its buffer\r
   //\r
   StatusCodeData = NULL;\r
-  StatusCodeData = AllocatePool (sizeof (EFI_STATUS_CODE_DATA) + ExtendedDataSize);\r
+  gBS->AllocatePool (EfiBootServicesData, sizeof (EFI_STATUS_CODE_DATA) + ExtendedDataSize, (VOID **)&StatusCodeData);\r
   if (StatusCodeData == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -528,7 +532,7 @@ ReportStatusCodeEx (
   //\r
   // Free the allocated buffer\r
   //\r
-  FreePool (StatusCodeData);\r
+  gBS->FreePool (StatusCodeData);\r
 \r
   return Status;\r
 }\r