ArmPlatformPkg/Bds: Fixed memory leak

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12997 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
oliviermartin 2012-02-09 15:29:35 +00:00
parent 3d565dd674
commit b148591a8c
2 changed files with 25 additions and 2 deletions

View File

@ -1,6 +1,6 @@
/** @file /** @file
* *
* Copyright (c) 2011, ARM Limited. All rights reserved. * Copyright (c) 2011-2012, ARM Limited. All rights reserved.
* *
* This program and the accompanying materials * This program and the accompanying materials
* are licensed and made available under the terms and conditions of the BSD License * are licensed and made available under the terms and conditions of the BSD License
@ -196,6 +196,17 @@ InitializeConsole (
gST->StdErr = gST->ConOut; 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; return EFI_SUCCESS;
} }
@ -344,6 +355,7 @@ StartDefaultBootOnTimeout (
} }
// In case of success, we should not return from this call. // In case of success, we should not return from this call.
} }
FreePool (BootOrder);
} }
} }
return EFI_SUCCESS; return EFI_SUCCESS;

View File

@ -1,6 +1,6 @@
/** @file /** @file
* *
* Copyright (c) 2011, ARM Limited. All rights reserved. * Copyright (c) 2011-2012, ARM Limited. All rights reserved.
* *
* This program and the accompanying materials * This program and the accompanying materials
* are licensed and made available under the terms and conditions of the BSD License * are licensed and made available under the terms and conditions of the BSD License
@ -82,6 +82,8 @@ BootOptionStart (
Initrd, // Initrd Initrd, // Initrd
(CHAR8*)(LinuxArguments + 1), (CHAR8*)(LinuxArguments + 1),
FdtDevicePath); FdtDevicePath);
FreePool (FdtDevicePath);
} }
} else { } else {
Status = BdsStartEfiApplication (mImageHandle, BootOption->FilePathList, BootOption->OptionalDataSize, BootOption->OptionalData); Status = BdsStartEfiApplication (mImageHandle, BootOption->FilePathList, BootOption->OptionalDataSize, BootOption->OptionalData);
@ -119,6 +121,8 @@ BootOptionList (
} }
} }
FreePool (BootOrder);
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -290,6 +294,11 @@ BootOptionCreate (
BootOrder BootOrder
); );
// We only free it if the UEFI Variable 'BootOrder' was already existing
if (BootOrderSize > sizeof(UINT16)) {
FreePool (BootOrder);
}
*BdsLoadOption = BootOption; *BdsLoadOption = BootOption;
return Status; return Status;
} }
@ -361,5 +370,7 @@ BootOptionDelete (
); );
} }
FreePool (BootOrder);
return EFI_SUCCESS; return EFI_SUCCESS;
} }