mirror of https://github.com/acidanthera/audk.git
ShellPkg: Fix memory leak in ShellProtocol.
1. Close unused file handle. 2. Free the local allocated buffer function returned. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <shumin.qiu@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19481 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
5772d0f540
commit
06e5ae774e
|
@ -1361,6 +1361,7 @@ EfiShellDeleteFileByName(
|
|||
//
|
||||
// now delete the file
|
||||
//
|
||||
ShellFileHandleRemove(FileHandle);
|
||||
return (ShellInfoObject.NewEfiShellProtocol->DeleteFile(FileHandle));
|
||||
}
|
||||
|
||||
|
@ -2338,6 +2339,8 @@ ShellSearchHandle(
|
|||
// recurse with the next part of the pattern
|
||||
//
|
||||
Status = ShellSearchHandle(NextFilePatternStart, UnicodeCollation, ShellInfoNode->Handle, FileList, ShellInfoNode, MapName);
|
||||
EfiShellClose(ShellInfoNode->Handle);
|
||||
ShellInfoNode->Handle = NULL;
|
||||
}
|
||||
} else if (!EFI_ERROR(Status)) {
|
||||
//
|
||||
|
@ -2456,6 +2459,7 @@ EfiShellFindFiles(
|
|||
; PatternCurrentLocation++);
|
||||
PatternCurrentLocation++;
|
||||
Status = ShellSearchHandle(PatternCurrentLocation, gUnicodeCollation, RootFileHandle, FileList, NULL, MapName);
|
||||
EfiShellClose(RootFileHandle);
|
||||
}
|
||||
FreePool(RootDevicePath);
|
||||
}
|
||||
|
@ -3260,6 +3264,7 @@ EfiShellGetAlias(
|
|||
|
||||
if (Volatile == NULL) {
|
||||
GetVariable2 (AliasLower, &gShellAliasGuid, (VOID **)&AliasVal, NULL);
|
||||
FreePool(AliasLower);
|
||||
return (AddBufferToFreeList(AliasVal));
|
||||
}
|
||||
RetSize = 0;
|
||||
|
@ -3273,6 +3278,7 @@ EfiShellGetAlias(
|
|||
if (RetVal != NULL) {
|
||||
FreePool(RetVal);
|
||||
}
|
||||
FreePool(AliasLower);
|
||||
return (NULL);
|
||||
}
|
||||
if ((EFI_VARIABLE_NON_VOLATILE & Attribs) == EFI_VARIABLE_NON_VOLATILE) {
|
||||
|
|
Loading…
Reference in New Issue