From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (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 182D3211F8883 for ; Fri, 6 Jul 2018 00:39:03 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jul 2018 00:39:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,315,1526367600"; d="scan'208";a="64650186" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga002.fm.intel.com with ESMTP; 06 Jul 2018 00:39:03 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 6 Jul 2018 00:39:03 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 6 Jul 2018 00:39:02 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.124]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.100]) with mapi id 14.03.0319.002; Fri, 6 Jul 2018 15:39:01 +0800 From: "Zeng, Star" To: Thomas Palmer , "edk2-devel@lists.01.org" CC: "Dong, Eric" , "garyli@hpe.com" , "joseph.shifflett@hpe.com" , "Zeng, Star" Thread-Topic: [PATCH 1/1] MdeModulePkg/UefiBootManagerLib: Fix small LoadOptionToVariable leak Thread-Index: AQHUEuyhcYv13ZOKU0yfCE1i6ZeFa6SB0FxwgAACjxA= Date: Fri, 6 Jul 2018 07:39:00 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103BB7B8CF@shsmsx102.ccr.corp.intel.com> References: <1530636052-6277-1-git-send-email-thomas.palmer@hpe.com> <0C09AFA07DD0434D9E2A0C6AEB0483103BB7B891@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103BB7B891@shsmsx102.ccr.corp.intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 1/1] MdeModulePkg/UefiBootManagerLib: Fix small LoadOptionToVariable leak X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jul 2018 07:39:04 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Pushed at 4d76bbcce62e3b972cd226e5f0e43d21db48a3f7. Thanks, Star -----Original Message----- From: Zeng, Star=20 Sent: Friday, July 6, 2018 3:30 PM To: Thomas Palmer ; edk2-devel@lists.01.org Cc: Dong, Eric ; garyli@hpe.com; joseph.shifflett@hpe.= com; Zeng, Star Subject: RE: [PATCH 1/1] MdeModulePkg/UefiBootManagerLib: Fix small LoadOpt= ionToVariable leak Reviewed-by: Star Zeng -----Original Message----- From: Thomas Palmer [mailto:thomas.palmer@hpe.com]=20 Sent: Wednesday, July 4, 2018 12:41 AM To: edk2-devel@lists.01.org Cc: Dong, Eric ; Zeng, Star ; gar= yli@hpe.com; joseph.shifflett@hpe.com; Thomas Palmer Subject: [PATCH 1/1] MdeModulePkg/UefiBootManagerLib: Fix small LoadOptionT= oVariable leak 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/MdeMo= dulePkg/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. =20 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 availab= le under the terms and conditions of the BSD License which accompanies thi= s distribution. The full text of the license may be found at @@ -250,13 +2= 50,16 @@ structure. VariableAttributes =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_= RUNTIME_ACCESS; } =20 - return gRT->SetVariable ( - OptionName, - &gEfiGlobalVariableGuid, - VariableAttributes, - VariableSize, - Variable - ); + Status =3D gRT->SetVariable ( + OptionName, + &gEfiGlobalVariableGuid, + VariableAttributes, + VariableSize, + Variable + ); + FreePool (Variable); + + return Status; } =20 /** -- 2.7.4