Skip to content

Commit

Permalink
ASoC: intel: Fix memleak in sst_media_open
Browse files Browse the repository at this point in the history
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.

Fixes: 0121327 ("ASoC: Intel: mfld-pcm: add control for powering up/down dsp")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200813084112.26205-1-dinghao.liu@zju.edu.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
dinghaoliu authored and broonie committed Aug 17, 2020
1 parent f082bb5 commit 062fa09
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sound/soc/intel/atom/sst-mfld-platform-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ static int sst_media_open(struct snd_pcm_substream *substream,

ret_val = power_up_sst(stream);
if (ret_val < 0)
return ret_val;
goto out_power_up;

/* Make sure, that the period size is always even */
snd_pcm_hw_constraint_step(substream->runtime, 0,
Expand All @@ -340,8 +340,9 @@ static int sst_media_open(struct snd_pcm_substream *substream,
return snd_pcm_hw_constraint_integer(runtime,
SNDRV_PCM_HW_PARAM_PERIODS);
out_ops:
kfree(stream);
mutex_unlock(&sst_lock);
out_power_up:
kfree(stream);
return ret_val;
}

Expand Down

0 comments on commit 062fa09

Please sign in to comment.