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
This commit is contained in:
Laszlo Ersek
2016-01-21 18:40:22 +00:00
committed by lersek
parent 5dc03ade6a
commit 40de6483ec

View File

@ -1050,7 +1050,7 @@ BcfgDisplayDump(
UINTN LoopVar; UINTN LoopVar;
UINTN LoopVar2; UINTN LoopVar2;
CHAR16 *DevPathString; CHAR16 *DevPathString;
VOID *DevPath; VOID *FilePathList;
UINTN Errors; UINTN Errors;
EFI_LOAD_OPTION *LoadOption; EFI_LOAD_OPTION *LoadOption;
CHAR16 *Description; CHAR16 *Description;
@ -1066,7 +1066,6 @@ BcfgDisplayDump(
for (LoopVar = 0 ; LoopVar < OrderCount ; LoopVar++) { for (LoopVar = 0 ; LoopVar < OrderCount ; LoopVar++) {
Buffer = NULL; Buffer = NULL;
BufferSize = 0; BufferSize = 0;
DevPath = NULL;
DevPathString = NULL; DevPathString = NULL;
UnicodeSPrint(VariableName, sizeof(VariableName), L"%s%04x", Op, CurrentOrder[LoopVar]); UnicodeSPrint(VariableName, sizeof(VariableName), L"%s%04x", Op, CurrentOrder[LoopVar]);
@ -1116,11 +1115,8 @@ BcfgDisplayDump(
DescriptionSize = StrSize (Description); DescriptionSize = StrSize (Description);
if (LoadOption->FilePathListLength != 0) { if (LoadOption->FilePathListLength != 0) {
DevPath = AllocateZeroPool(LoadOption->FilePathListLength); FilePathList = (UINT8 *)Description + DescriptionSize;
if (DevPath != NULL) { DevPathString = ConvertDevicePathToText(FilePathList, TRUE, FALSE);
CopyMem(DevPath, Buffer+6+DescriptionSize, LoadOption->FilePathListLength);
DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);
}
} }
ShellPrintHiiEx( ShellPrintHiiEx(
-1, -1,
@ -1153,9 +1149,6 @@ Cleanup:
if (Buffer != NULL) { if (Buffer != NULL) {
FreePool(Buffer); FreePool(Buffer);
} }
if (DevPath != NULL) {
FreePool(DevPath);
}
if (DevPathString != NULL) { if (DevPathString != NULL) {
FreePool(DevPathString); FreePool(DevPathString);
} }