diff options
author | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-02-09 15:28:25 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-02-09 15:28:25 +0000 |
commit | 3d565dd6740ba4ca7428811589484c5baef0db8a (patch) | |
tree | ca1d03cd60bca4a78762117ccdc5890f0475d9f7 /ArmPkg | |
parent | 7598f36265e156f516fe93e0416d4d5b2cd70101 (diff) | |
download | edk2-3d565dd6740ba4ca7428811589484c5baef0db8a.tar.gz edk2-3d565dd6740ba4ca7428811589484c5baef0db8a.tar.bz2 edk2-3d565dd6740ba4ca7428811589484c5baef0db8a.zip |
ArmPkg/BdsLib: Fixed memory leak
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12996 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg')
-rw-r--r-- | ArmPkg/Library/BdsLib/BdsLoadOption.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ArmPkg/Library/BdsLib/BdsLoadOption.c b/ArmPkg/Library/BdsLib/BdsLoadOption.c index fbf92c616e..8abbc9b5cd 100644 --- a/ArmPkg/Library/BdsLib/BdsLoadOption.c +++ b/ArmPkg/Library/BdsLib/BdsLoadOption.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 @@ -216,7 +216,7 @@ BootOptionToLoadOptionVariable ( } // Update (or Create) the BootOrder environment variable - Status = gRT->SetVariable ( + gRT->SetVariable ( L"BootOrder", &gEfiGlobalVariableGuid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, @@ -224,6 +224,11 @@ BootOptionToLoadOptionVariable ( BootOrder ); DEBUG((EFI_D_ERROR,"Create %s\n",BootVariableName)); + + // Free memory allocated by GetEnvironmentVariable + if (!EFI_ERROR(Status)) { + FreePool (BootOrder); + } } else { DEBUG((EFI_D_ERROR,"Update %s\n",BootVariableName)); } @@ -258,6 +263,7 @@ BootOptionAllocateBootIndex ( return BootIndex; } } + FreePool (BootOrder); } // Return the first index return 0; |