]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Fix Shell ASSERT when read 'TAB' key fail from 'ConIn'.
authorQiu Shumin <shumin.qiu@intel.com>
Fri, 11 Mar 2016 05:32:52 +0000 (13:32 +0800)
committerQiu Shumin <shumin.qiu@intel.com>
Mon, 14 Mar 2016 08:24:46 +0000 (16:24 +0800)
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>
ShellPkg/Application/Shell/FileHandleWrappers.c

index 1a0c9992abefea128c6e101f97bed547ecfce46b..0e5efe30255631f36b972715c49a464970f88677 100644 (file)
@@ -572,8 +572,7 @@ FileInterfaceStdInRead(
             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
@@ -856,6 +855,9 @@ FileInterfaceStdInRead(
   // 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