summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-11 08:03:27 +0000
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-11 08:03:27 +0000
commit41a907e423eaa4eec32b924c89474e1285abd012 (patch)
tree5c98fdcbb2adf4f3ef45450afdb77f109992e736
parentb12dbde369a174c6e73c7bc1aeb7518aea64c4a7 (diff)
downloadedk2-platforms-41a907e423eaa4eec32b924c89474e1285abd012.tar.xz
Add checking for memory allocation in UI modules.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2219 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.c9
-rw-r--r--EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Forms.c2
-rw-r--r--EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/InputHandler.c1
-rw-r--r--EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.c3
4 files changed, 15 insertions, 0 deletions
diff --git a/EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.c b/EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.c
index 5f3823c612..c383d1660a 100644
--- a/EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.c
+++ b/EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.c
@@ -94,11 +94,13 @@ Returns:
// Need some memory for OptionList. Allow for up to 8 options.
//
OptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 8);
+ ASSERT (OptionList != NULL);
//
// Allocate space for creation of Buffer
//
UpdateData = AllocateZeroPool (0x1000);
+ ASSERT (UpdateData != NULL);
//
// Remove all the op-codes starting with Label 0x2222 to next Label (second label is for convenience
@@ -170,11 +172,13 @@ Returns:
// Need some memory for OptionList. Allow for up to 8 options.
//
OptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 8);
+ ASSERT (OptionList != NULL);
//
// Allocate space for creation of Buffer
//
UpdateData = AllocateZeroPool (0x1000);
+ ASSERT (UpdateData != NULL);
//
// Remove all the op-codes starting with Label 0x2222 to next Label (second label is for convenience
@@ -244,6 +248,7 @@ Returns:
0x1000,
(VOID **) &UpdateData
);
+ ASSERT_EFI_ERROR (Status);
ZeroMem (UpdateData, 0x1000);
@@ -297,6 +302,7 @@ Returns:
0x1000,
(VOID **)&UpdateData
);
+ ASSERT_EFI_ERROR (Status);
ZeroMem (UpdateData, 0x1000);
@@ -366,6 +372,7 @@ Returns:
sizeof (EFI_HII_CALLBACK_PACKET) + sizeof (SAMPLE_STRING) + 2,
(VOID **) Packet
);
+ ASSERT_EFI_ERROR (Status);
ZeroMem (*Packet, sizeof (EFI_HII_CALLBACK_PACKET) + sizeof (SAMPLE_STRING) + 2);
@@ -384,6 +391,7 @@ Returns:
sizeof (EFI_HII_CALLBACK_PACKET) + 2,
(VOID **) Packet
);
+ ASSERT_EFI_ERROR (Status);
ZeroMem (*Packet, sizeof (EFI_HII_CALLBACK_PACKET) + 2);
@@ -585,6 +593,7 @@ DriverSampleInit (
0x1000,
(VOID **) &UpdateData
);
+ ASSERT_EFI_ERROR (Status);
ZeroMem (UpdateData, 0x1000);
diff --git a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Forms.c b/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Forms.c
index 2c625fe86e..4178284a49 100644
--- a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Forms.c
+++ b/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Forms.c
@@ -1409,6 +1409,8 @@ Returns:
TempBufferSize += PackageInstance->IfrSize + PackageInstance->StringSize;
TempBuffer = AllocateZeroPool (TempBufferSize);
+ ASSERT (TempBuffer != NULL);
+
OrigTempBuffer = TempBuffer;
//
diff --git a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/InputHandler.c b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/InputHandler.c
index d84fcf02b1..466039f8dc 100644
--- a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/InputHandler.c
+++ b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/InputHandler.c
@@ -1233,6 +1233,7 @@ GetSelectionInputPopUp (
//
if (StrLen (StringPtr) > (PopUpWidth - 1)) {
TempStringPtr = AllocateZeroPool (sizeof (CHAR16) * (PopUpWidth - 1));
+ ASSERT (TempStringPtr != NULL);
CopyMem (TempStringPtr, StringPtr, (sizeof (CHAR16) * (PopUpWidth - 5)));
gBS->FreePool (StringPtr);
StringPtr = TempStringPtr;
diff --git a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.c b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.c
index 7a2ec04403..369d2b4911 100644
--- a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.c
+++ b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.c
@@ -3003,7 +3003,10 @@ Returns:
FileFormTags->VariableDefinitions->VariableFakeSize = (UINT16) (FileFormTags->VariableDefinitions->VariableFakeSize + FileFormTags->VariableDefinitions->VariableSize);
FileFormTags->VariableDefinitions->NvRamMap = AllocateZeroPool (FileFormTags->VariableDefinitions->VariableSize);
+ ASSERT (FileFormTags->VariableDefinitions->NvRamMap != NULL);
+
FileFormTags->VariableDefinitions->FakeNvRamMap = AllocateZeroPool (NvMapSize + FileFormTags->VariableDefinitions->VariableFakeSize);
+ ASSERT (FileFormTags->VariableDefinitions->FakeNvRamMap != NULL);
CopyMem (FileFormTags->VariableDefinitions->NvRamMap, NvMap, NvMapSize);
gBS->FreePool (NvMapListHead);