ShellPkg: Fix the TAB-auto-completion memory leak.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19522 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Qiu Shumin 2015-12-24 08:25:52 +00:00 committed by shenshushi
parent 14810d6b64
commit 594e780bb9
1 changed files with 3 additions and 0 deletions

View File

@ -1205,6 +1205,7 @@ DoShellPrompt (
CONST CHAR16 *CurDir; CONST CHAR16 *CurDir;
UINTN BufferSize; UINTN BufferSize;
EFI_STATUS Status; EFI_STATUS Status;
LIST_ENTRY OldBufferList;
CurDir = NULL; CurDir = NULL;
@ -1218,6 +1219,7 @@ DoShellPrompt (
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
SaveBufferList(&OldBufferList);
CurDir = ShellInfoObject.NewEfiShellProtocol->GetEnv(L"cwd"); CurDir = ShellInfoObject.NewEfiShellProtocol->GetEnv(L"cwd");
// //
@ -1247,6 +1249,7 @@ DoShellPrompt (
// //
// Done with this command // Done with this command
// //
RestoreBufferList(&OldBufferList);
FreePool (CmdLine); FreePool (CmdLine);
return Status; return Status;
} }