aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}