summaryrefslogtreecommitdiffstats
path: root/ShellPkg
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2016-07-22 10:08:01 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2016-07-25 10:20:13 +0800
commit51686a7a294191a5ea87dc89b3167b01297ee6b0 (patch)
tree3f47360ffe893e12ef25d4ab9d7e4ad6db5dd9e8 /ShellPkg
parentcb9f3a59c390c94d5fb252c7f9b44571db90adf2 (diff)
downloadedk2-51686a7a294191a5ea87dc89b3167b01297ee6b0.tar.gz
edk2-51686a7a294191a5ea87dc89b3167b01297ee6b0.tar.bz2
edk2-51686a7a294191a5ea87dc89b3167b01297ee6b0.zip
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>
Diffstat (limited to 'ShellPkg')
-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;
}