From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=15.233.44.26; helo=g2t2353.austin.hpe.com; envelope-from=thomas.palmer@hpe.com; receiver=edk2-devel@lists.01.org Received: from g2t2353.austin.hpe.com (g2t2353.austin.hpe.com [15.233.44.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 07F31210C1250 for ; Tue, 3 Jul 2018 09:40:55 -0700 (PDT) Received: from arm-build-server.us.rdlabs.hpecorp.net (arm-build-server.us.rdlabs.hpecorp.net [16.84.24.54]) by g2t2353.austin.hpe.com (Postfix) with ESMTP id 7A57865; Tue, 3 Jul 2018 16:40:54 +0000 (UTC) From: Thomas Palmer To: edk2-devel@lists.01.org Cc: eric.dong@intel.com, star.zeng@intel.com, garyli@hpe.com, joseph.shifflett@hpe.com, Thomas Palmer Date: Tue, 3 Jul 2018 11:40:52 -0500 Message-Id: <1530636052-6277-1-git-send-email-thomas.palmer@hpe.com> X-Mailer: git-send-email 2.7.4 Subject: [PATCH 1/1] MdeModulePkg/UefiBootManagerLib: Fix small LoadOptionToVariable leak X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2018 16:40:56 -0000 After calling SetVariable, the allocated memory in Variable should be freed. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Thomas Palmer --- .../Library/UefiBootManagerLib/BmLoadOption.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c index ff0c65a2efc6..7bf96646c690 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.
-(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
+(C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP
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; } /** -- 2.7.4