Cc: Ruiyu Ni <[email protected]>
Cc: Jaben Carsey <[email protected]>
Cc: Yao Jiewen <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yao Jiewen <[email protected]>
Reviewed-by: Qiu Shumin <[email protected]>
---
ShellPkg/Application/Shell/ShellProtocol.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/ShellPkg/Application/Shell/ShellProtocol.c
b/ShellPkg/Application/Shell/ShellProtocol.c
index a6bf9c2..22d3987 100644
--- a/ShellPkg/Application/Shell/ShellProtocol.c
+++ b/ShellPkg/Application/Shell/ShellProtocol.c
@@ -185,6 +185,9 @@ EfiShellSetMap(
){
if (StringNoCaseCompare(&MapListNode->MapName, &Mapping) == 0) {
RemoveEntryList(&MapListNode->Link);
+ SHELL_FREE_NON_NULL(MapListNode->DevicePath);
+ SHELL_FREE_NON_NULL(MapListNode->MapName);
+ SHELL_FREE_NON_NULL(MapListNode->CurrentDirectoryPath);
FreePool(MapListNode);
return (EFI_SUCCESS);
}
@@ -2951,6 +2954,8 @@ EfiShellSetCurDir(
}
if (MapListItem == NULL) {
+ FreePool (DirectoryName);
+ SHELL_FREE_NON_NULL(MapName);
return (EFI_NOT_FOUND);
}
@@ -2967,6 +2972,7 @@ EfiShellSetCurDir(
ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) ||
(MapListItem->CurrentDirectoryPath != NULL));
MapListItem->CurrentDirectoryPath =
StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size,
DirectoryName+StrLen(MapName), 0);
}
+ FreePool (MapName);
} else {
ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) ||
(MapListItem->CurrentDirectoryPath != NULL));
MapListItem->CurrentDirectoryPath =
StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, DirectoryName, 0);
@@ -2982,6 +2988,7 @@ EfiShellSetCurDir(
// cant have a mapping in the directory...
//
if (StrStr(DirectoryName, L":") != NULL) {
+ FreePool (DirectoryName);
return (EFI_INVALID_PARAMETER);
}
//
@@ -2989,6 +2996,7 @@ EfiShellSetCurDir(
//
MapListItem = ShellCommandFindMapItem(FileSystem);
if (MapListItem == NULL) {
+ FreePool (DirectoryName);
return (EFI_INVALID_PARAMETER);
}
// gShellCurDir = MapListItem;
@@ -3013,6 +3021,7 @@ EfiShellSetCurDir(
}
}
}
+ FreePool (DirectoryName);
//
// if updated the current directory then update the environment variable
//
--
1.9.5.msysgit.1
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel