summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellLib/UefiShellLib.c
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Library/UefiShellLib/UefiShellLib.c')
-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;