summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2019-02-19 15:04:27 +0300
committerMark Brown <broonie@kernel.org>2019-02-19 15:23:25 +0000
commita6d9cef30eb11b2de8cbfed9065e3dc5b1f829a8 (patch)
treeaf6fcdf72ee68f85e0356ade2b2326f1812b8ce4
parentf89aea0f132142b29dc0c8cf4d445bd12db7b1a6 (diff)
downloadlinux-stable-a6d9cef30eb11b2de8cbfed9065e3dc5b1f829a8.tar.gz
linux-stable-a6d9cef30eb11b2de8cbfed9065e3dc5b1f829a8.tar.bz2
linux-stable-a6d9cef30eb11b2de8cbfed9065e3dc5b1f829a8.zip
ASoC: dapm: Potential small memory leak in dapm_cnew_widget()
We should free "w" on the error path. Fixes: 199ed3e81c49 ("ASoC: dapm: fix use-after-free issue with dailink sname") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/soc-dapm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index dea6fc2353e4..1ec06ef6d161 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -332,8 +332,10 @@ static inline struct snd_soc_dapm_widget *dapm_cnew_widget(
*/
if (_widget->sname) {
w->sname = kstrdup_const(_widget->sname, GFP_KERNEL);
- if (!w->sname)
+ if (!w->sname) {
+ kfree(w);
return NULL;
+ }
}
return w;
}