summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2016-01-21 18:40:22 +0000
committerHao Wu <hao.a.wu@intel.com>2016-07-13 20:41:35 +0800
commit3a5d7ce52642cf555c15a87c983bdfb306a1eb69 (patch)
treee1a6e6efa907b5ad9c77d2b687e570cbf0e1760b
parent05f3fb2539188b9dd108bb1227506923d0f0278d (diff)
downloadedk2-platforms-3a5d7ce52642cf555c15a87c983bdfb306a1eb69.tar.xz
ShellPkg: BcfgDisplayDump(): eliminate FilePathList duplication
Copying and releasing each EFI_LOAD_OPTION.FilePathList under the name DevPath is wasteful -- we only need FilePathList for a single conversion to text. Do it directly from the EFI_LOAD_OPTION object. This patch is not supposed to change observable behavior. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ryan Harkin <ryan.harkin@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19713 6f19259b-4bc3-4df7-8a09-765794883524 (cherry picked from commit 40de6483ec902472dabf61332595194937f5c260)
-rw-r--r--ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
index aac85d3850..d109ca29a7 100644
--- a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
+++ b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
@@ -1050,7 +1050,7 @@ BcfgDisplayDump(
UINTN LoopVar;
UINTN LoopVar2;
CHAR16 *DevPathString;
- VOID *DevPath;
+ VOID *FilePathList;
UINTN Errors;
EFI_LOAD_OPTION *LoadOption;
CHAR16 *Description;
@@ -1066,7 +1066,6 @@ BcfgDisplayDump(
for (LoopVar = 0 ; LoopVar < OrderCount ; LoopVar++) {
Buffer = NULL;
BufferSize = 0;
- DevPath = NULL;
DevPathString = NULL;
UnicodeSPrint(VariableName, sizeof(VariableName), L"%s%04x", Op, CurrentOrder[LoopVar]);
@@ -1116,11 +1115,8 @@ BcfgDisplayDump(
DescriptionSize = StrSize (Description);
if (LoadOption->FilePathListLength != 0) {
- DevPath = AllocateZeroPool(LoadOption->FilePathListLength);
- if (DevPath != NULL) {
- CopyMem(DevPath, Buffer+6+DescriptionSize, LoadOption->FilePathListLength);
- DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);
- }
+ FilePathList = (UINT8 *)Description + DescriptionSize;
+ DevPathString = ConvertDevicePathToText(FilePathList, TRUE, FALSE);
}
ShellPrintHiiEx(
-1,
@@ -1153,9 +1149,6 @@ Cleanup:
if (Buffer != NULL) {
FreePool(Buffer);
}
- if (DevPath != NULL) {
- FreePool(DevPath);
- }
if (DevPathString != NULL) {
FreePool(DevPathString);
}