summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2016-07-22 10:08:01 +0800
committerHao Wu <hao.a.wu@intel.com>2016-07-25 11:05:48 +0800
commit4f4d9290931df6c7fc37bc186deedc298c349e52 (patch)
tree290487c6d6c132a399bb0ef10e36985d441fe242
parent2e8b25f857bb2a1b2e16f9d488f3ddf216d79c3b (diff)
downloadedk2-platforms-4f4d9290931df6c7fc37bc186deedc298c349e52.tar.xz
ShellPkg: Fix a potential NULL pointer deference issue
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> (cherry picked from commit 51686a7a294191a5ea87dc89b3167b01297ee6b0)
-rw-r--r--ShellPkg/Application/Shell/ShellProtocol.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c
index c3331def82..55a1e43f06 100644
--- a/ShellPkg/Application/Shell/ShellProtocol.c
+++ b/ShellPkg/Application/Shell/ShellProtocol.c
@@ -3699,8 +3699,10 @@ CreatePopulateInstallShellProtocol (
);
if (!EFI_ERROR(Status)) {
OldProtocolNode = AllocateZeroPool(sizeof(SHELL_PROTOCOL_HANDLE_LIST));
- if (OldProtocolNode == NULL && !IsListEmpty (&ShellInfoObject.OldShellList.Link)) {
- CleanUpShellProtocol (&mShellProtocol);
+ if (OldProtocolNode == NULL) {
+ if (!IsListEmpty (&ShellInfoObject.OldShellList.Link)) {
+ CleanUpShellProtocol (&mShellProtocol);
+ }
Status = EFI_OUT_OF_RESOURCES;
break;
}