summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/UefiBootManagerLib
diff options
context:
space:
mode:
authorThomas Palmer <thomas.palmer@hpe.com>2018-07-04 00:40:52 +0800
committerStar Zeng <star.zeng@intel.com>2018-07-06 15:38:15 +0800
commit4d76bbcce62e3b972cd226e5f0e43d21db48a3f7 (patch)
treec685c5687dab4d6ac99f47af5cdcf441e0caf9be /MdeModulePkg/Library/UefiBootManagerLib
parent4adf7074eb01b5fd13b20f4d2ec05648e2231377 (diff)
downloadedk2-4d76bbcce62e3b972cd226e5f0e43d21db48a3f7.tar.gz
edk2-4d76bbcce62e3b972cd226e5f0e43d21db48a3f7.tar.bz2
edk2-4d76bbcce62e3b972cd226e5f0e43d21db48a3f7.zip
MdeModulePkg/UefiBootManagerLib: Fix small LoadOptionToVariable leak
After calling SetVariable, the allocated memory in Variable should be freed. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
Diffstat (limited to 'MdeModulePkg/Library/UefiBootManagerLib')
-rw-r--r--MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
index ff0c65a2ef..7bf96646c6 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
@@ -2,7 +2,7 @@
Load option library functions which relate with creating and processing load options.
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
-(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
+(C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -250,13 +250,16 @@ structure.
VariableAttributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
}
- return gRT->SetVariable (
- OptionName,
- &gEfiGlobalVariableGuid,
- VariableAttributes,
- VariableSize,
- Variable
- );
+ Status = gRT->SetVariable (
+ OptionName,
+ &gEfiGlobalVariableGuid,
+ VariableAttributes,
+ VariableSize,
+ Variable
+ );
+ FreePool (Variable);
+
+ return Status;
}
/**