summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2009-06-29 07:29:39 +0000
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2009-06-29 07:29:39 +0000
commit1fa282ec235841faae3259b1bd9517dd681ee465 (patch)
tree7e64a47c58dbe858d6a2913b6f2998d3da01ea93
parentd14faa5275ef4e26c4137a69abc03d7f9fef3fce (diff)
downloadedk2-platforms-1fa282ec235841faae3259b1bd9517dd681ee465.tar.xz
Add check for memory allocation.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8678 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c b/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
index 1c2192a11d..ac29009c74 100644
--- a/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
+++ b/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
@@ -491,11 +491,15 @@ ReportStatusCodeEx (
ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));
ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));
+ if (gBS == NULL || gBS->AllocatePool == NULL || gBS->FreePool == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+
//
// Allocate space for the Status Code Header and its buffer
//
StatusCodeData = NULL;
- StatusCodeData = AllocatePool (sizeof (EFI_STATUS_CODE_DATA) + ExtendedDataSize);
+ gBS->AllocatePool (EfiBootServicesData, sizeof (EFI_STATUS_CODE_DATA) + ExtendedDataSize, (VOID **)&StatusCodeData);
if (StatusCodeData == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -528,7 +532,7 @@ ReportStatusCodeEx (
//
// Free the allocated buffer
//
- FreePool (StatusCodeData);
+ gBS->FreePool (StatusCodeData);
return Status;
}