From 9c17810a3635f6c0ca2afa78e3ec05bbb807d4be Mon Sep 17 00:00:00 2001 From: Qiu Shumin Date: Fri, 11 Mar 2016 13:32:52 +0800 Subject: [PATCH] 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 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin Reviewed-by: Ruiyu Ni --- 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 1a0c9992ab..0e5efe3025 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.39.2