From patchwork Tue Jul 3 16:40:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Palmer, Thomas" X-Patchwork-Id: 140991 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1377345ljj; Tue, 3 Jul 2018 09:40:57 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKYJ0vg+jEM2GKCbfVv7tkibNCRtCdrUwMFcQzeV3gYhgPYUNXkV4bvXOQg1cvN4klEWJZZ X-Received: by 2002:a63:35c3:: with SMTP id c186-v6mr26149226pga.217.1530636057688; Tue, 03 Jul 2018 09:40:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530636057; cv=none; d=google.com; s=arc-20160816; b=ynxnUYR30L37Y+JMg3QuA6VzbR5/NeHblADSfwa94nDn+7IC8ASupnlEOJDpMHjg0X EuBqca9nUVCohtt5wM9wFhflyNMWf5N4AhlxrrQuUPnxmFLDW8nC0sWl5b75G63Lu1uc wg8Pz3WwYlz/jKmV3QYdAMrrx+f63qWMrNh+HadHYjPTMJLFtQjqFngZjjcefilL2hJs VrYyZFCphcGm4JqYW62ShVJd9orirI60otQyxLe3NLPHp3RLfrvHGsf2G0lvGmKOqcxP cC6IAOBahfFHakMNLXzTaQR1I2TqMqMvK+WgcD1HofQZqpRF9YsT63r4uMY8sXsq6MXX 7mvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=wGC4IPibTvwWf5Zz7R9dMN5cpLumFBpqh4vdGStb/bU=; b=W7x04FEdLfKJBDqyv2Eh7JSqFgQDdShkW9AJe/4CoSvQhnao66jb23SDNiRk0aGW5d yT67F3tZblIVEmCQEq+tPQFk04LgvsJyDbwtU/zyIJWxzMSBjUKKJXuLNP8OLuGpxpBo j9ipvTqwyHbFEPZP2Y4p1/GkYmMQEreBYByxQe3Uhmkra1vpU/bvIhuLKM6zJw+xj21q oIPs+AWE/fDWjsccH7lLcjKlZBU12CHuAqVdqlnChoCt0oTV/H/SBJv7liMJ0LNRGGqR eUEc/7WAUlw4T9fzXgicCd55r4yQf4MX1KnElgeXr0CVhi5sJ/kiMJWdnXB8xOdLgy+Y YDeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id d39-v6si1471999pla.41.2018.07.03.09.40.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jul 2018 09:40:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E0644210C1EF8; Tue, 3 Jul 2018 09:40:56 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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 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: [edk2] [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: , Cc: eric.dong@intel.com, star.zeng@intel.com MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Star Zeng Signed-off-by: Thomas Palmer Reviewed-by: Star Zeng Signed-off-by: Thomas Palmer 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; } /**