ASoC: topology: Fix a potential memory leak in 'soc_tplg_dapm_widget_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: 1a7dd6e2f1 ("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>
This commit is contained in:
Christophe JAILLET 2017-09-14 22:44:24 +02:00 коммит произвёл Mark Brown
Родитель 6d5574ed5c
Коммит f3ee9096fc
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -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)