Re: [PATCH] ASoC: intel: Fix memory leak in sst_media_open()
9 Aug
2020
9 Aug
'20
8:42 p.m.
When power_up_sst() fails, stream needs to be freed just like when try_module_get() fails. However, current code is returning directly and ends up leaking memory.
Would an imperative wording be preferred for the change description? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Docu...
…
+++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c @@ -330,8 +330,10 @@ static int sst_media_open(struct snd_pcm_substream *substream, runtime->private_data = stream;
ret_val = power_up_sst(stream);
- if (ret_val < 0)
- if (ret_val < 0) {
return ret_val;kfree(stream);
- }
…
I propose to add a jump target so that a bit of common exception handling code can be better reused at the end of this function implementation.
Regards, Markus
1596
Age (days ago)
1596
Last active (days ago)
0 comments
1 participants
participants (1)
-
Markus Elfring