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 8FA41940F14 for ; Wed, 11 Jun 2025 04:03:17 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=gz6pLE83gkIddnYlebK4Q6bcpmdXqecdznQlNhrX9Sw=; c=relaxed/simple; d=groups.io; h=From:To:Subject:Date:Message-Id: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=NLLKv/hxePmslEcdHyrP20+T/8AON6q7qPKjeIIerGrY31z6njDiMmwCLKzWSPeeSVNnsEOX gPdn6uL5QWdHhjyK+jbpChF9Swj7VbDw5NSTRYODUz4ybh5ENOVcAzdhi9OjB0TxcZX7FGr2qvE xT66p9OS41ok1fzBbljbo4D3X8HjTThsHO4CLp7OLCwGoBSf7iNyg/l9rK6aBONDyL4yz2M6Wvo zvhvQTCcvVqPYBc5CIHQP7LngnTh7QuZmuET/nzfR2XRg8yYTHu6Q19e6cjGBL67KVROYrcWgic oT1G9XRLM0YJOW3IoOgomSwBq291De/XMiEp2+kZDtEAQ== X-Received: by 127.0.0.2 with SMTP id 8cZIYY7687511xoFV27CGNiN; 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.2637.1749614591795015841 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 _____8Bx22r8_0hoyF4TAQ--.12701S3; 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--.61653S2; Wed, 11 Jun 2025 12:03:07 +0800 (CST) From: "Dongyan Qian" To: devel@edk2.groups.io Subject: [edk2-devel] [PATCH 1/4] MdeModulePkg/SpiBus: Free handle buffers after LocateHandleBuffer Date: Wed, 11 Jun 2025 12:03:03 +0800 Message-Id: <20250611040306.199659-1-qiandongyan@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: qMiowMAxDcX7_0ho5G0VAQ--.61653S2 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: ac6QUq9rvvV2sNDOv8tIAc0xx7686176AA= 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="NLLKv/hx"; 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: release SpiHcHandles in SpiBusEntry exit path. 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 --- MdeModulePkg/Bus/Spi/SpiBus/SpiBusDxe.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MdeModulePkg/Bus/Spi/SpiBus/SpiBusDxe.c b/MdeModulePkg/Bus/Spi/SpiBus/SpiBusDxe.c index a2b77e79c6..37ce3e14ad 100644 --- a/MdeModulePkg/Bus/Spi/SpiBus/SpiBusDxe.c +++ b/MdeModulePkg/Bus/Spi/SpiBus/SpiBusDxe.c @@ -193,6 +193,13 @@ SpiBusEntry ( } Exit: + // + // Free the buffer containing the list of handles from the handle database + // + if (SpiHcHandles != NULL) { + gBS->FreePool (SpiHcHandles); + } + DEBUG ((DEBUG_VERBOSE, "%a - EXIT (Status = %r)\n", __func__, Status)); return Status; } -- 2.49.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#121415): https://edk2.groups.io/g/devel/message/121415 Mute This Topic: https://groups.io/mt/113583367/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-