]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Application/Shell/Shell.c
ShellPkg: Fix the TAB-auto-completion memory leak.
[mirror_edk2.git] / ShellPkg / Application / Shell / Shell.c
index 465f4f3974c12bfaf7469cf88a3bcf2fa2cb82c9..40ae68d5a81f978976856de8c4b30f804aea62fa 100644 (file)
@@ -1205,6 +1205,7 @@ DoShellPrompt (
   CONST CHAR16  *CurDir;\r
   UINTN         BufferSize;\r
   EFI_STATUS    Status;\r
+  LIST_ENTRY    OldBufferList;\r
 \r
   CurDir  = NULL;\r
 \r
@@ -1218,6 +1219,7 @@ DoShellPrompt (
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
+  SaveBufferList(&OldBufferList);\r
   CurDir = ShellInfoObject.NewEfiShellProtocol->GetEnv(L"cwd");\r
 \r
   //\r
@@ -1247,6 +1249,7 @@ DoShellPrompt (
   //\r
   // Done with this command\r
   //\r
+  RestoreBufferList(&OldBufferList);\r
   FreePool (CmdLine);\r
   return Status;\r
 }\r