mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-26 21:54:11 +08:00
ASoC: dapm: Potential small memory leak in dapm_cnew_widget()
We should free "w" on the error path.
Fixes: 199ed3e81c
("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>
This commit is contained in:
parent
f89aea0f13
commit
a6d9cef30e
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user