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>
TabLinePos = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FoundFileList->Link);\r
InTabScrolling = TRUE;\r
} else {\r
- FreePool(FoundFileList);\r
- FoundFileList = NULL;\r
+ ShellInfoObject.NewEfiShellProtocol->FreeFileList (&FoundFileList);\r
}\r
}\r
}\r
// if this was used it should be deallocated by now...\r
// prevent memory leaks...\r
//\r
+ if (FoundFileList != NULL) {\r
+ ShellInfoObject.NewEfiShellProtocol->FreeFileList (&FoundFileList);\r
+ }\r
ASSERT(FoundFileList == NULL);\r
\r
return Status;\r