summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg
diff options
context:
space:
mode:
authorOlivier Martin <olivier.martin@arm.com>2014-12-12 19:11:56 +0000
committeroliviermartin <oliviermartin@Edk2>2014-12-12 19:11:56 +0000
commit830e5b8c0f8dda3c46313200e1464548b2b7d2a3 (patch)
tree01842ba8f24750a54daaf660b78dbb1a49e1b6fb /ArmPlatformPkg
parent23666400234149a9c64b5881805db49cb8342ee7 (diff)
downloadedk2-platforms-830e5b8c0f8dda3c46313200e1464548b2b7d2a3.tar.xz
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 <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16514 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg')
-rw-r--r--ArmPlatformPkg/Bds/BootMenu.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c
index 91e00b759e..3a72df0495 100644
--- a/ArmPlatformPkg/Bds/BootMenu.c
+++ b/ArmPlatformPkg/Bds/BootMenu.c
@@ -341,6 +341,9 @@ BootMenuAddBootOption (
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 @@ BootMenuUpdateBootOption (
// 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 @@ UpdateFdtPath (
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",