From f8d3e6898a4c7660291917de31c9ba77d18c0b35 Mon Sep 17 00:00:00 2001 From: jcarsey Date: Tue, 19 Apr 2011 17:54:42 +0000 Subject: [PATCH] check that memory allocation was successful. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11568 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiShellLib/UefiShellLib.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- 2.39.2