[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240122172044.3840976-1-alexious@zju.edu.cn>
Date: Tue, 23 Jan 2024 01:20:44 +0800
From: Zhipeng Lu <alexious@....edu.cn>
To: alexious@....edu.cn
Cc: Parthiban Veerasooran <parthiban.veerasooran@...rochip.com>,
Christian Gromm <christian.gromm@...rochip.com>,
Dan Carpenter <error27@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH] most: fix a memleak in audio_probe_channel
When get_channel fails, audio_probe_channel should free adpt like all
its following error-handling paths after get_channel. Otherwise there
could be a memleak.
Fixes: 15600aea2754 ("staging: most: sound: create one sound card w/ multiple PCM devices per MOST device")
Signed-off-by: Zhipeng Lu <alexious@....edu.cn>
---
drivers/most/most_snd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/most/most_snd.c b/drivers/most/most_snd.c
index 45d762804c5e..6cccc9c26796 100644
--- a/drivers/most/most_snd.c
+++ b/drivers/most/most_snd.c
@@ -564,7 +564,8 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id,
if (get_channel(iface, channel_id)) {
pr_err("channel (%s:%d) is already linked\n",
iface->description, channel_id);
- return -EEXIST;
+ ret = -EEXIST;
+ goto err_free_adpt;
}
if (cfg->direction == MOST_CH_TX) {
--
2.34.1
Powered by blists - more mailing lists