[PATCH] ASoC: intel: Fix memory leak in sst_media_open()
Markus Elfring
Markus.Elfring at web.de
Sun Aug 9 20:42:59 CEST 2020
> 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/Documentation/process/submitting-patches.rst?id=06a81c1c7db9bd5de0bd38cd5acc44bb22b99150#n151
…
> +++ 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) {
> + kfree(stream);
> return ret_val;
> + }
…
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
More information about the Alsa-devel
mailing list