aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiam Girdwood <liam.r.girdwood@linux.intel.com>2017-06-06 10:45:09 -0400
committerMark Brown <broonie@kernel.org>2017-06-07 15:05:40 -0400
commitc3421a6a65abc636b067eb15a4c5e9cb59e91c95 (patch)
treeec50c022c5d5f32848a5883fb1a125633678120f
parentcc9d4714a8da98f905c63d74e9897fc6f4563fca (diff)
ASoC: topology: Dont free template strings whilst they are in use.
Template name pointers are copied when creating new widgets and are freed in widget destroy. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/soc-topology.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index f24d1f2e82a0..7006cf3007b5 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1477,6 +1477,7 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg,
1477 if (template.id < 0) 1477 if (template.id < 0)
1478 return template.id; 1478 return template.id;
1479 1479
1480 /* strings are allocated here, but used and freed by the widget */
1480 template.name = kstrdup(w->name, GFP_KERNEL); 1481 template.name = kstrdup(w->name, GFP_KERNEL);
1481 if (!template.name) 1482 if (!template.name)
1482 return -ENOMEM; 1483 return -ENOMEM;
@@ -1589,8 +1590,6 @@ widget:
1589 widget->dobj.widget.kcontrol_type = kcontrol_type; 1590 widget->dobj.widget.kcontrol_type = kcontrol_type;
1590 widget->dobj.ops = tplg->ops; 1591 widget->dobj.ops = tplg->ops;
1591 widget->dobj.index = tplg->index; 1592 widget->dobj.index = tplg->index;
1592 kfree(template.sname);
1593 kfree(template.name);
1594 list_add(&widget->dobj.list, &tplg->comp->dobj_list); 1593 list_add(&widget->dobj.list, &tplg->comp->dobj_list);
1595 1594
1596 ret = soc_tplg_widget_ready(tplg, widget, w); 1595 ret = soc_tplg_widget_ready(tplg, widget, w);