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 DAD627803CE for ; Wed, 11 Jun 2025 04:03:17 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=+MRt52/p78JttEdGn3kZid85vjrzs/592AxK1k7aGMI=; 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=1749614597; v=1; x=1749873796; b=nEEn7cgSNE8cgKLJXoTZBZHcRSOJKRyn+MKOUkDOsCJt83c7caCpPJj0SerzCMPsuiB7M01I tXXsSpKLUQlcUY3wGB77dJTLqpoWeGnJy0VEZI90XakGNPWEvXWGHUh2cXkewqN4F9825b/1Tol jh69b6rPKxTJbNm9WRPp0clm9XHuwzodMleijMvVjfE698YBDmWONeR+npF9RrtUjDAHCoAsC3w C5jp1WpimY4dykI8Gzrr04G9beoyAXJY9JktpGnwe0Mke/gnCsW9X2EGcvBuP9Ndc2JAXMApH2O w1aZSVhHpnDRTJIlNSL2yIDvtfVWO6kIIfmp341rb5mvQ== X-Received: by 127.0.0.2 with SMTP id JEYIYY7687511xuoMETSMD43; Tue, 10 Jun 2025 21:03:16 -0700 X-Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mx.groups.io with SMTP id smtpd.web11.2638.1749614591795167755 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 _____8CxPuP9_0hoy14TAQ--.12473S3; Wed, 11 Jun 2025 12:03:09 +0800 (CST) X-Received: from code-server.gen (unknown [10.2.9.245]) by front1 (Coremail) with SMTP id qMiowMAxDcX7_0ho5G0VAQ--.61653S5; Wed, 11 Jun 2025 12:03:08 +0800 (CST) From: "Dongyan Qian" To: devel@edk2.groups.io Subject: [edk2-devel] [PATCH 4/4] RedfishPkg/RedfishConfigHandler: Free handle buffers after LocateHandleBuffer Date: Wed, 11 Jun 2025 12:03:06 +0800 Message-Id: <20250611040306.199659-4-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--.61653S5 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: 17EzUad6fjcOIGPaR2p5gYr9x7686176AA= 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=nEEn7cgS; 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 handle buffers in Stop and initialization routines. 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 --- .../RedfishConfigHandler/RedfishConfigHandlerCommon.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c index bc1ba59835..d0e6a1aca7 100644 --- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c @@ -189,7 +189,7 @@ RedfishConfigCommonStop ( &HandleBuffer ); if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { - return Status; + goto Exit; } Status = EFI_SUCCESS; @@ -208,6 +208,11 @@ RedfishConfigCommonStop ( } } +Exit: + if (HandleBuffer != NULL) { + FreePool (HandleBuffer); + } + return Status; } @@ -272,4 +277,8 @@ RedfishConfigHandlerInitialization ( ); ASSERT_EFI_ERROR (Status); } + + if (HandleBuffer != NULL) { + gBS->FreePool (HandleBuffer); + } } -- 2.49.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#121413): https://edk2.groups.io/g/devel/message/121413 Mute This Topic: https://groups.io/mt/113583365/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-