From c87bb070a6007605b13adc2f8f2b93086aed7956 Mon Sep 17 00:00:00 2001 From: Ruiyu Ni Date: Tue, 12 Jul 2016 17:39:43 +0800 Subject: ShellPkg/DMem: Handle memory allocation failure Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Reviewed-by: Jaben Carsey --- ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c') diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c index 7693835b88..5491f6de57 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c @@ -1,7 +1,7 @@ /** @file Main file for Dmem shell Debug1 function. - Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.
(C) Copyright 2015 Hewlett Packard Enterprise Development LP
This program and the accompanying materials @@ -68,7 +68,9 @@ DisplayMmioMemory( return (SHELL_NOT_FOUND); } Buffer = AllocateZeroPool(Size); - ASSERT(Buffer != NULL); + if (Buffer == NULL) { + return SHELL_OUT_OF_RESOURCES; + } Status = PciRbIo->Mem.Read(PciRbIo, EfiPciWidthUint8, (UINT64)(UINTN)Address, Size, Buffer); if (EFI_ERROR(Status)) { -- cgit v1.2.3