mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] most: fix a memleak in audio_probe_channel
@ 2024-01-22 17:20 Zhipeng Lu
  2024-01-23  6:04 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Zhipeng Lu @ 2024-01-22 17:20 UTC (permalink / raw)
  To: alexious
  Cc: Parthiban Veerasooran, Christian Gromm, Dan Carpenter,
	Greg Kroah-Hartman, linux-kernel

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@zju.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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-29 12:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-22 17:20 [PATCH] most: fix a memleak in audio_probe_channel Zhipeng Lu
2024-01-23  6:04 ` Dan Carpenter
2024-01-29 12:56   ` alexious

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®