Skip to content

Commit 062fa09

Browse files
dinghaoliubroonie
authored andcommitted
ASoC: intel: Fix memleak in sst_media_open
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 <[email protected]> Acked-by: Pierre-Louis Bossart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent f082bb5 commit 062fa09

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sound/soc/intel/atom/sst-mfld-platform-pcm.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ static int sst_media_open(struct snd_pcm_substream *substream,
331331

332332
ret_val = power_up_sst(stream);
333333
if (ret_val < 0)
334-
return ret_val;
334+
goto out_power_up;
335335

336336
/* Make sure, that the period size is always even */
337337
snd_pcm_hw_constraint_step(substream->runtime, 0,
@@ -340,8 +340,9 @@ static int sst_media_open(struct snd_pcm_substream *substream,
340340
return snd_pcm_hw_constraint_integer(runtime,
341341
SNDRV_PCM_HW_PARAM_PERIODS);
342342
out_ops:
343-
kfree(stream);
344343
mutex_unlock(&sst_lock);
344+
out_power_up:
345+
kfree(stream);
345346
return ret_val;
346347
}
347348

0 commit comments

Comments
 (0)