summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellLevel1CommandsLib
diff options
context:
space:
mode:
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2010-10-04 16:30:40 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2010-10-04 16:30:40 +0000
commit9ea69f8a05b808b4bab81b608436a02e2f2fba09 (patch)
treef07ec891e7841fec0b8570c68e1dfddfd59e2d62 /ShellPkg/Library/UefiShellLevel1CommandsLib
parentd38a107995ef90254713dcebf8f6bddb70183a1e (diff)
downloadedk2-platforms-9ea69f8a05b808b4bab81b608436a02e2f2fba09.tar.xz
Verify memory allocations were successful.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10909 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiShellLevel1CommandsLib')
-rw-r--r--ShellPkg/Library/UefiShellLevel1CommandsLib/For.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c
index 0e68119b8d..297a137664 100644
--- a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c
+++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c
@@ -103,8 +103,11 @@ typedef struct {
@param[in] Alias The alias to test for.
@param[in] CommandString The updated command string.
@param[in,out] List The list to search.
+
+ @retval EFI_SUCCESS The operation was completed successfully.
+ @retval EFI_OUT_OF_RESOURCES There was not enough free memory.
**/
-VOID
+EFI_STATUS
EFIAPI
InternalUpdateAliasOnList(
IN CONST CHAR16 *Alias,
@@ -139,12 +142,16 @@ InternalUpdateAliasOnList(
}
if (!Found) {
Node = AllocateZeroPool(sizeof(ALIAS_LIST));
+ if (Node == NULL) {
+ return (EFI_OUT_OF_RESOURCES);
+ }
ASSERT(Node->Alias == NULL);
Node->Alias = StrnCatGrow(&Node->Alias, NULL, Alias, 0);
ASSERT(Node->CommandString == NULL);
Node->CommandString = StrnCatGrow(&Node->CommandString, NULL, CommandString, 0);
InsertTailList(List, &Node->Link);
}
+ return (EFI_SUCCESS);
}
/**