diff options
author | Ruiyu Ni <ruiyu.ni@intel.com> | 2016-07-13 17:43:47 +0800 |
---|---|---|
committer | Ruiyu Ni <ruiyu.ni@intel.com> | 2016-07-18 11:04:22 +0800 |
commit | e7a5a238c32f62441ed5a156525b9db96f0892da (patch) | |
tree | 7d16bbd99d6f7e6aa00250b1ae13a6ae53ec67c2 /ShellPkg | |
parent | a915fea68e6bea900755f85e81cdc1070b9f3dc6 (diff) | |
download | edk2-e7a5a238c32f62441ed5a156525b9db96f0892da.tar.gz edk2-e7a5a238c32f62441ed5a156525b9db96f0892da.tar.bz2 edk2-e7a5a238c32f62441ed5a156525b9db96f0892da.zip |
ShellPkg/Ping6: Handle memory allocation failure
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Diffstat (limited to 'ShellPkg')
-rw-r--r-- | ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c index 4496802eac..90a2604388 100644 --- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c @@ -961,7 +961,11 @@ ShellPing6 ( ShellStatus = SHELL_SUCCESS;
Private = AllocateZeroPool (sizeof (PING6_PRIVATE_DATA));
- ASSERT (Private != NULL);
+ if (Private == NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellNetwork2HiiHandle, L"Ping6");
+ ShellStatus = SHELL_OUT_OF_RESOURCES;
+ goto ON_EXIT;
+ }
Private->ImageHandle = ImageHandle;
Private->SendNum = SendNumber;
|