diff options
author | Ruiyu Ni <ruiyu.ni@intel.com> | 2016-07-13 17:43:47 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2016-07-25 11:05:21 +0800 |
commit | 3c75b62e73087675dad626304b0f7916a4b30f37 (patch) | |
tree | b0dec92a0f22346be16abcb70563f55c9f20264d | |
parent | 433e146251d53c9a95046a2c3d36fa313e0a62f8 (diff) | |
download | edk2-platforms-3c75b62e73087675dad626304b0f7916a4b30f37.tar.xz |
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>
(cherry picked from commit e7a5a238c32f62441ed5a156525b9db96f0892da)
-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;
|