ShellPkg/DMem: 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>
This commit is contained in:
Ruiyu Ni 2016-07-12 17:39:43 +08:00
parent 107d05a433
commit c87bb070a6
1 changed files with 4 additions and 2 deletions

View File

@ -1,7 +1,7 @@
/** @file
Main file for Dmem shell Debug1 function.
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
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)) {