未验证 提交 a6d9cef3 编写于 作者: D Dan Carpenter 提交者: Mark Brown

ASoC: dapm: Potential small memory leak in dapm_cnew_widget()

We should free "w" on the error path.

Fixes: 199ed3e8 ("ASoC: dapm: fix use-after-free issue with dailink sname")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 f89aea0f
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册