summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2011-04-19 17:54:42 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2011-04-19 17:54:42 +0000
commitf8d3e6898a4c7660291917de31c9ba77d18c0b35 (patch)
tree296be61c3cf6d3c2dbec87029682817a54258db9
parentf20076daaf8509e815a37fd0cb5453b9c3b9a79d (diff)
downloadedk2-platforms-f8d3e6898a4c7660291917de31c9ba77d18c0b35.tar.xz
check that memory allocation was successful.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11568 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--ShellPkg/Library/UefiShellLib/UefiShellLib.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index d4a80e403c..d65f427cee 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -2606,6 +2606,12 @@ InternalShellPrintWorker(
mPostReplaceFormat = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize));
mPostReplaceFormat2 = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize));
+ if (mPostReplaceFormat == NULL || mPostReplaceFormat2 == NULL) {
+ SHELL_FREE_NON_NULL(mPostReplaceFormat);
+ SHELL_FREE_NON_NULL(mPostReplaceFormat2);
+ return (EFI_OUT_OF_RESOURCES);
+ }
+
Status = EFI_SUCCESS;
OriginalAttribute = gST->ConOut->Mode->Attribute;