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>
This commit is contained in:
Ruiyu Ni 2016-07-22 10:08:01 +08:00
parent cb9f3a59c3
commit 51686a7a29
1 changed files with 4 additions and 2 deletions

View File

@ -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;
}