From patchwork Mon Mar 16 18:30:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2021 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773685890; bh=rLil9DMUxyJ9cusWpTdgPBTruIMJUW11PbCSQwuO4OY=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=C4IC4uPv5/gKYlq/s1yVp26GlrH8XmYva59eOwGiLLIeinJe5m4aOBFev0xiOM30N Qagkbb2h94aowXHiYDY752B65PrayhvUbLffedn0K02Th7yt+MumeDGmFwryIx2Ia7 sX/Lc0iEtHIJFq2gQHvhuqrWh1fntpJDXqCgeB9GYCmBiUoCuGD9DYQTWs1GIZqVEK +H8/zZuXc7QT2bJJwC58hrKhQaQO50HKmHLTfCruKMBTPicDCM+v5rZVdzP9hlUurJ ltDmALkRK6195eRWfVIl7Qp1GyUvvq3col/1FZAH89YeT68cGF/38NA4NcO0Ip0iVT MOLh0QyOt5FJw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4BAE26A0BA for ; Mon, 16 Mar 2026 12:31:30 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id AL8WMpWeNQ6n for ; Mon, 16 Mar 2026 12:31:30 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773685888; bh=rLil9DMUxyJ9cusWpTdgPBTruIMJUW11PbCSQwuO4OY=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=qqvJ9CAnF0rkbxb9gECKUqA4jh5B39TwH4f/C/RVcDX0sl3R9bSGozERTuPbJXFhk eGqAVFAbW9DJqlNtqZAcoPY26I1mJtOvgHTKzrSTfpe+HkZFeqI7Gjm0wGqusZ157H qJ6siDLdfz2syo2maON5HXr/47dENdUGehbEFbkgSsKeCvPaDopUsYWpU+ZWdObMwh FvnZ7JY0GkC6GLofJf7mJaJh8csIgSGxzAO0/WXtGvvjshxMZZTuueAPJrBCLq+f3x +Utsrc65VP2UaRBddKxApWjm1h2d9puNRLpBbxZ80ZRnIEp4VCyT1h8ytvwTgVMESD ZETV29lYSMbqw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 204AC6A0A9 for ; Mon, 16 Mar 2026 12:31:28 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773685882; bh=2RTD6bcaV0zY01kYLc5G5bIrT8ughiP7MqdOHy6l8d0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oc4ytIW2kbzlyVu2WEBU+dePGPH5AnF7AVZdR9EhtSjJDqPg07AWZ4jkqXOfR/yNj P934VuWBx+crSAX45nMqsZ0XWjUu+7brPRNSOdtrS/iaBwAmAseH4EIO4HRD+NDKdd pn+sOa3uH4yqzIG1bamyeMZ2tzi9aZv71CebsTAsu6fEM6tDYHQllm33+QXvk4kCI9 onwA7/8/iUcWhZVkRORMv7vpAs+bbaPkhckGm39mH5lsspMWsFZNafW7ofuBBhk0qg wp/whIiDgwhZEybBCv43Et4lZ9q3VLuaeQ5L/YGTMjRXGYI5ghWf4Nf3o2vou7jaup GwtQ660ewwrSg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8C2C56A0A5; Mon, 16 Mar 2026 12:31:22 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id XwcfCBodsSiA; Mon, 16 Mar 2026 12:31:22 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773685881; bh=HfNaFp0NoIrcFpu+ZN5BmQJW5NfkaRqNKcsvixXNqJw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e+SSW0xy/Wxi4ldrk6ur24ESrhNl1TcwdlF29cRPj1TSqiAk6C9tLHQTbewBUevfS GsYp23O4f5UnVmxol2GpsVMXtWiPYSrvvERtXTzOOlQrldJa8JdI7UzQlSPAJnfiGS +ANFV6bHtrOyCHvUMkMeZRFo6q/S35qNkbY50ncVniOT6221Ib8sHppaUHj4zGO59h X5q/VtN+MvH7a4diqpe7Vnx56B4EXDWZ4orn1AEIq7phI2T8AkGIl8fBqgFrglkf6T pDhLRyGdZYe15C+rwUv3ASUgX9zl8rQPXrLufvlB5jCdk/gYyiHlL8mTT/ztHVn1OO SXD68QvXbWNaQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id CFAD86A081; Mon, 16 Mar 2026 12:31:20 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 16 Mar 2026 12:30:34 -0600 Message-ID: <20260316183050.3855921-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260316183050.3855921-1-sjg@u-boot.org> References: <20260316183050.3855921-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: UQVVJW6A3IU37GQBTDGVSME77ICUWYQ3 X-Message-ID-Hash: UQVVJW6A3IU37GQBTDGVSME77ICUWYQ3 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 11/17] firmware: scmi: Fix memory leak in protocol list discovery List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The output buffer allocated in scmi_base_discover_list_protocols_int() is freed on the error path but not on the success path. Add the missing free(out) before returning on success. Fixes: ec8727b7e1c1 ("firmware: scmi: implement SCMI base protocol") Signed-off-by: Simon Glass --- drivers/firmware/scmi/base.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/firmware/scmi/base.c b/drivers/firmware/scmi/base.c index 78ee2ffd2da..d591b23d158 100644 --- a/drivers/firmware/scmi/base.c +++ b/drivers/firmware/scmi/base.c @@ -304,6 +304,7 @@ static int scmi_base_discover_list_protocols_int(struct udevice *dev, } while (cur < num_protocols); *protocols = buf; + free(out); return num_protocols; err: