]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/Bds: Fixed memory leak
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 9 Feb 2012 15:29:35 +0000 (15:29 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 9 Feb 2012 15:29:35 +0000 (15:29 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12997 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/Bds/Bds.c
ArmPlatformPkg/Bds/BootOption.c

index 176311e8a28b48dd445caf5ea602f299e23f8375..8f7f9fdf7ced1541b067caa2590e2712ecf6ece1 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 *\r
-*  Copyright (c) 2011, ARM Limited. All rights reserved.\r
+*  Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r
 *  \r
 *  This program and the accompanying materials                          \r
 *  are licensed and made available under the terms and conditions of the BSD License         \r
@@ -196,6 +196,17 @@ InitializeConsole (
     gST->StdErr = gST->ConOut;\r
   }\r
 \r
+  // Free Memory allocated for reading the UEFI Variables\r
+  if (ConOutDevicePaths) {\r
+    FreePool (ConOutDevicePaths);\r
+  }\r
+  if (ConInDevicePaths) {\r
+    FreePool (ConInDevicePaths);\r
+  }\r
+  if (ConErrDevicePaths) {\r
+    FreePool (ConErrDevicePaths);\r
+  }\r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -344,6 +355,7 @@ StartDefaultBootOnTimeout (
         }\r
         // In case of success, we should not return from this call.\r
       }\r
+      FreePool (BootOrder);\r
     }\r
   }\r
   return EFI_SUCCESS;\r
index d811c03ccc2030b7224a78601aedf278d9d2d725..3710178a43c83abc109fe912d73f0f692a092f89 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 *\r
-*  Copyright (c) 2011, ARM Limited. All rights reserved.\r
+*  Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r
 *\r
 *  This program and the accompanying materials\r
 *  are licensed and made available under the terms and conditions of the BSD License\r
@@ -82,6 +82,8 @@ BootOptionStart (
                                 Initrd, // Initrd\r
                                 (CHAR8*)(LinuxArguments + 1),\r
                                 FdtDevicePath);\r
+\r
+      FreePool (FdtDevicePath);\r
     }\r
   } else {\r
     Status = BdsStartEfiApplication (mImageHandle, BootOption->FilePathList, BootOption->OptionalDataSize, BootOption->OptionalData);\r
@@ -119,6 +121,8 @@ BootOptionList (
     }\r
   }\r
 \r
+  FreePool (BootOrder);\r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -290,6 +294,11 @@ BootOptionCreate (
       BootOrder\r
       );\r
 \r
+  // We only free it if the UEFI Variable 'BootOrder' was already existing\r
+  if (BootOrderSize > sizeof(UINT16)) {\r
+    FreePool (BootOrder);\r
+  }\r
+\r
   *BdsLoadOption = BootOption;\r
   return Status;\r
 }\r
@@ -361,5 +370,7 @@ BootOptionDelete (
         );\r
   }\r
 \r
+  FreePool (BootOrder);\r
+\r
   return EFI_SUCCESS;\r
 }\r