Free 'FoundFileList' when read 'TAB' key fail to avoid memory leak and ASSERT.
Cc: Jaben Carsey <[email protected]> Cc: Ruiyu Ni <[email protected]> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <[email protected]> --- ShellPkg/Application/Shell/FileHandleWrappers.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ShellPkg/Application/Shell/FileHandleWrappers.c b/ShellPkg/Application/Shell/FileHandleWrappers.c index 1a0c999..0e5efe3 100644 --- a/ShellPkg/Application/Shell/FileHandleWrappers.c +++ b/ShellPkg/Application/Shell/FileHandleWrappers.c @@ -572,8 +572,7 @@ FileInterfaceStdInRead( TabLinePos = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FoundFileList->Link); InTabScrolling = TRUE; } else { - FreePool(FoundFileList); - FoundFileList = NULL; + ShellInfoObject.NewEfiShellProtocol->FreeFileList (&FoundFileList); } } } @@ -856,6 +855,9 @@ FileInterfaceStdInRead( // if this was used it should be deallocated by now... // prevent memory leaks... // + if (FoundFileList != NULL) { + ShellInfoObject.NewEfiShellProtocol->FreeFileList (&FoundFileList); + } ASSERT(FoundFileList == NULL); return Status; -- 2.7.1.windows.2 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

