Revision: 19713
          http://sourceforge.net/p/edk2/code/19713
Author:   lersek
Date:     2016-01-21 18:40:22 +0000 (Thu, 21 Jan 2016)
Log Message:
-----------
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 <[email protected]>
Cc: Ryan Harkin <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>

Modified Paths:
--------------
    
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c

Modified: 
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
===================================================================
--- 
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c   
    2016-01-21 18:40:17 UTC (rev 19712)
+++ 
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c   
    2016-01-21 18:40:22 UTC (rev 19713)
@@ -1050,7 +1050,7 @@
   UINTN           LoopVar;
   UINTN           LoopVar2;
   CHAR16          *DevPathString;
-  VOID            *DevPath;
+  VOID            *FilePathList;
   UINTN           Errors;
   EFI_LOAD_OPTION *LoadOption;
   CHAR16          *Description;
@@ -1066,7 +1066,6 @@
   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 @@
     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 @@
     if (Buffer != NULL) {
       FreePool(Buffer);
     }
-    if (DevPath != NULL) {
-      FreePool(DevPath);
-    }
     if (DevPathString != NULL) {
       FreePool(DevPathString);
     }


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to