Skip to content

Commit

Permalink
ASoC: topology: Fix a potential memory leak in 'soc_tplg_dapm_widget_…
Browse files Browse the repository at this point in the history
…denum_create()'

If this sanity check fails, we must free the memory that has already been
allocated.

So we must go to 'err' as in the other error handling parth of this
function.

Fixes: 1a7dd6e ("ASoC: topology: Allow a widget to have multiple enum controls")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Christophe JAILLET authored and Mark Brown committed Sep 14, 2017
1 parent 6d5574e commit f3ee909
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/soc/soc-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,7 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_denum_create(
/* validate kcontrol */
if (strnlen(ec->hdr.name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) ==
SNDRV_CTL_ELEM_ID_NAME_MAXLEN)
return NULL;
goto err;

se = kzalloc(sizeof(*se), GFP_KERNEL);
if (se == NULL)
Expand Down

0 comments on commit f3ee909

Please sign in to comment.