]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Bds/BootOption.c
ArmPlatformPkg/Bds: Fixed update of boot entries
[mirror_edk2.git] / ArmPlatformPkg / Bds / BootOption.c
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