From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 6A08BAC09B8 for ; Wed, 11 Jun 2025 04:03:15 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=XutVQuwme4FRFkgZuOdMa5KPEFQ2Hm+MgFviC1cO/0A=; c=relaxed/simple; d=groups.io; h=From:To:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240830; t=1749614595; v=1; x=1749873793; b=A3l1GqScL2Lfp96UDm9R7ti9Tb982yhtBpZ3uIqoqpeQMpPF4qNCZYkdbHZ4Bb13CV3z2PKf 94Jz67BIoQ1SavUbABJ1TixyaZ1wc568VJvhQjIJ5pdk1mi+TAnys4pFI4t+arbl8cElSFPDb+K 137cJQyk1bMAUEWMYUJwrOvH6g9LOIBDwZXVZQwiWbBv9TYunQwVJskwLbdZNZBo4UzAxC0XY6t DlTPHHqvL+SO/iUevUcR96W/2mZ5kAszfVavxAEHlGCOn6MnCar4PhdLGba5bmeweqy/BD/DSxB +NdlAV6F8Mr0s7lPU3y4Ns17leWnpPfyP3fSlc4j/9Bgg== X-Received: by 127.0.0.2 with SMTP id ZRV4YY7687511xYYqmGa1FDZ; Tue, 10 Jun 2025 21:03:13 -0700 X-Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mx.groups.io with SMTP id smtpd.web11.2640.1749614591919986856 for ; Tue, 10 Jun 2025 21:03:12 -0700 X-Received: from loongson.cn (unknown [10.2.9.245]) by gateway (Coremail) with SMTP id _____8BxrnL8_0hoyV4TAQ--.48311S3; Wed, 11 Jun 2025 12:03:08 +0800 (CST) X-Received: from code-server.gen (unknown [10.2.9.245]) by front1 (Coremail) with SMTP id qMiowMAxDcX7_0ho5G0VAQ--.61653S3; Wed, 11 Jun 2025 12:03:08 +0800 (CST) From: "Dongyan Qian" To: devel@edk2.groups.io Subject: [edk2-devel] [PATCH 2/4] NetworkPkg/HttpUtilitiesDxe: Free handle buffers after LocateHandleBuffer Date: Wed, 11 Jun 2025 12:03:04 +0800 Message-Id: <20250611040306.199659-2-qiandongyan@loongson.cn> In-Reply-To: <20250611040306.199659-1-qiandongyan@loongson.cn> References: <20250611040306.199659-1-qiandongyan@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: qMiowMAxDcX7_0ho5G0VAQ--.61653S3 X-CM-SenderInfo: htld0v5rqj5t3q6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Tue, 10 Jun 2025 21:03:12 -0700 Resent-From: qiandongyan@loongson.cn Reply-To: devel@edk2.groups.io,qiandongyan@loongson.cn List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 3FT9zouO4djBOeoZ7K1YDIxWx7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240830 header.b=A3l1GqSc; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io Fix memory leaks by adding missing FreePool calls: free HandleBuffer in HttpUtilitiesDxeUnload. REF: https://uefi.org/sites/default/files/resources/UEFI_Spec_Final_2.11.pdf Chapter 7.3.15: "Services - Boot Services.LocateHandleBuffer": It is the caller's responsibility to call the Boot Service.FreePool when the caller no longer requires the contents of Buffer. Signed-off-by: Dongyan Qian --- NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.c b/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.c index a3e1ea4691..308d3b1ce9 100644 --- a/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.c +++ b/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.c @@ -59,7 +59,7 @@ HttpUtilitiesDxeUnload ( EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL ); if (EFI_ERROR (Status)) { - return Status; + goto Exit; } // @@ -72,10 +72,15 @@ HttpUtilitiesDxeUnload ( NULL ); if (EFI_ERROR (Status)) { - return Status; + goto Exit; } } +Exit: + if (HandleBuffer != NULL) { + gBS->FreePool (HandleBuffer); + } + return EFI_SUCCESS; } -- 2.49.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#121416): https://edk2.groups.io/g/devel/message/121416 Mute This Topic: https://groups.io/mt/113583368/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-