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