All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	alsa-devel@alsa-project.org
Subject: [PATCH] ASoC: topology: Dont free template strings whilst they are in use.
Date: Tue,  6 Jun 2017 15:45:09 +0100	[thread overview]
Message-ID: <1496760309-6195-4-git-send-email-liam.r.girdwood@linux.intel.com> (raw)
In-Reply-To: <1496760309-6195-1-git-send-email-liam.r.girdwood@linux.intel.com>

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>
---
 sound/soc/soc-topology.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index b0bbb0756f69..b4626298f7eb 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 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg,
 	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);
-- 
2.11.0

  parent reply	other threads:[~2017-06-06 14:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06 14:45 [PATCH] ASoC: topology: Fix build by declaring snd_kcontrol_new and soc_dai_link Liam Girdwood
2017-06-06 14:45 ` [PATCH] ASoC: topology: Allow bespoke configuration post widget creation Liam Girdwood
2017-06-07 19:31   ` Applied "ASoC: topology: Allow bespoke configuration post widget creation" to the asoc tree Mark Brown
2017-06-06 14:45 ` [PATCH] ASoC: topology: rephrase deferred binding warning Liam Girdwood
2017-06-07 19:31   ` Applied "ASoC: topology: rephrase deferred binding warning." to the asoc tree Mark Brown
2017-06-06 14:45 ` Liam Girdwood [this message]
2017-06-07 19:31   ` Applied "ASoC: topology: Dont free template strings whilst they are in use." " Mark Brown
2017-06-06 14:49 ` [PATCH] ASoC: topology: Fix build by declaring snd_kcontrol_new and soc_dai_link Liam Girdwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1496760309-6195-4-git-send-email-liam.r.girdwood@linux.intel.com \
    --to=liam.r.girdwood@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.