diff options
author | Laszlo Ersek <lersek@redhat.com> | 2016-01-21 18:40:22 +0000 |
---|---|---|
committer | lersek <lersek@Edk2> | 2016-01-21 18:40:22 +0000 |
commit | 40de6483ec902472dabf61332595194937f5c260 (patch) | |
tree | be59b0f7f52c47fc3358074415043aae0e70bde2 /ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c | |
parent | 5dc03ade6adbb7e91ec7ce90045692154dbef2aa (diff) | |
download | edk2-40de6483ec902472dabf61332595194937f5c260.zip edk2-40de6483ec902472dabf61332595194937f5c260.tar.gz edk2-40de6483ec902472dabf61332595194937f5c260.tar.bz2 |
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
Diffstat (limited to 'ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c')
-rw-r--r-- | ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c index aac85d3..d109ca2 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);
}
|