From: Liam Girdwood Date: Tue, 6 Jun 2017 14:45:09 +0000 (+0100) Subject: ASoC: topology: Dont free template strings whilst they are in use. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c3421a6a65abc636b067eb15a4c5e9cb59e91c95;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Mark Brown --- 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, if (template.id < 0) return template.id; + /* strings are allocated here, but used and freed by the widget */ template.name = kstrdup(w->name, GFP_KERNEL); if (!template.name) return -ENOMEM; @@ -1589,8 +1590,6 @@ widget: widget->dobj.widget.kcontrol_type = kcontrol_type; widget->dobj.ops = tplg->ops; widget->dobj.index = tplg->index; - kfree(template.sname); - kfree(template.name); list_add(&widget->dobj.list, &tplg->comp->dobj_list); ret = soc_tplg_widget_ready(tplg, widget, w);