Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit a6d9cef3 authored by Dan Carpenter's avatar Dan Carpenter Committed by Mark Brown
Browse files

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f89aea0f
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -332,9 +332,11 @@ 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;
}