Revision: 16514
          http://sourceforge.net/p/edk2/code/16514
Author:   oliviermartin
Date:     2014-12-12 19:11:56 +0000 (Fri, 12 Dec 2014)
Log Message:
-----------
ArmPlatformPkg/Bds: Fixed memory leak

Device Paths were not freed after calling
BDS_LOAD_OPTION_SUPPORT.CreateDevicePathNode()

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ArmPlatformPkg/Bds/BootMenu.c

Modified: trunk/edk2/ArmPlatformPkg/Bds/BootMenu.c
===================================================================
--- trunk/edk2/ArmPlatformPkg/Bds/BootMenu.c    2014-12-12 19:10:58 UTC (rev 
16513)
+++ trunk/edk2/ArmPlatformPkg/Bds/BootMenu.c    2014-12-12 19:11:56 UTC (rev 
16514)
@@ -341,6 +341,9 @@
       if (InitrdPathNodes != NULL) {
         // Append the Device Path to the selected device path
         InitrdPath = AppendDevicePath 
(SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL 
*)InitrdPathNodes);
+        // Free the InitrdPathNodes created by Support->CreateDevicePathNode()
+        FreePool (InitrdPathNodes);
+
         if (InitrdPath == NULL) {
           Status = EFI_OUT_OF_RESOURCES;
           goto EXIT;
@@ -540,6 +543,8 @@
           // Append the Device Path to the selected device path
           InitrdPath = AppendDevicePath (TempInitrdPath, (CONST 
EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNodes);
           FreePool (TempInitrdPath);
+          // Free the InitrdPathNodes created by 
Support->CreateDevicePathNode()
+          FreePool (InitrdPathNodes);
           if (InitrdPath == NULL) {
             Status = EFI_OUT_OF_RESOURCES;
             goto EXIT;
@@ -846,6 +851,8 @@
   if (FdtDevicePathNodes != NULL) {
     // Append the Device Path node to the select device path
     FdtDevicePath = AppendDevicePath (SupportedBootDevice->DevicePathProtocol, 
FdtDevicePathNodes);
+    // Free the FdtDevicePathNodes created by Support->CreateDevicePathNode()
+    FreePool (FdtDevicePathNodes);
     FdtDevicePathSize = GetDevicePathSize (FdtDevicePath);
     Status = gRT->SetVariable (
                     (CHAR16*)L"Fdt",


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to