ShellPkg: Fix Shell ASSERT when read 'TAB' key fail from 'ConIn'.

Free 'FoundFileList' when read 'TAB' key fail to avoid memory leak and ASSERT.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
Qiu Shumin 2016-03-11 13:32:52 +08:00
parent 53c1329529
commit 9c17810a36
1 changed files with 4 additions and 2 deletions

View File

@ -572,8 +572,7 @@ FileInterfaceStdInRead(
TabLinePos = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FoundFileList->Link); TabLinePos = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FoundFileList->Link);
InTabScrolling = TRUE; InTabScrolling = TRUE;
} else { } else {
FreePool(FoundFileList); ShellInfoObject.NewEfiShellProtocol->FreeFileList (&FoundFileList);
FoundFileList = NULL;
} }
} }
} }
@ -856,6 +855,9 @@ FileInterfaceStdInRead(
// if this was used it should be deallocated by now... // if this was used it should be deallocated by now...
// prevent memory leaks... // prevent memory leaks...
// //
if (FoundFileList != NULL) {
ShellInfoObject.NewEfiShellProtocol->FreeFileList (&FoundFileList);
}
ASSERT(FoundFileList == NULL); ASSERT(FoundFileList == NULL);
return Status; return Status;