alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: liam.r.girdwood@linux.intel.com, alsa-devel@alsa-project.org,
	broonie@kernel.org, vkoul@kernel.org,
	"Amadeusz Sławiński" <amadeuszx.slawinski@intel.com>
Subject: Re: [PATCH 3/7] ASoC: topology: Fix memory leak from soc_tplg_denum_create_texts
Date: Mon, 28 Jan 2019 09:36:37 -0600	[thread overview]
Message-ID: <aa48c0a9-8e5d-9fc8-7f86-21441ed8c833@linux.intel.com> (raw)
In-Reply-To: <s5hva2b8gch.wl-tiwai@suse.de>


On 1/26/19 11:43 AM, Takashi Iwai wrote:
> On Fri, 25 Jan 2019 21:06:44 +0100,
> Pierre-Louis Bossart wrote:
>> From: Amadeusz Sławiński <amadeuszx.slawinski@intel.com>
>>
>> dtexts is two dimensional array, so we also need to free it after
>> freeing its fields.
>>
>> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@intel.com>
>> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
>> ---
>>   sound/soc/soc-topology.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
>> index abc2d804d5bf..71bc5b8a9bd3 100644
>> --- a/sound/soc/soc-topology.c
>> +++ b/sound/soc/soc-topology.c
>> @@ -410,6 +410,7 @@ static void remove_enum(struct snd_soc_component *comp,
>>   	kfree(dobj->control.dvalues);
>>   	for (i = 0; i < se->items; i++)
>>   		kfree(dobj->control.dtexts[i]);
>> +	kfree(dobj->control.dtexts);
>>   	kfree(se);
>>   }
>>   
>> @@ -467,6 +468,7 @@ static void remove_widget(struct snd_soc_component *comp,
>>   			kfree(dobj->control.dvalues);
>>   			for (j = 0; j < se->items; j++)
>>   				kfree(dobj->control.dtexts[j]);
>> +			kfree(dobj->control.dtexts);
>>   
>>   			kfree(se);
>>   			kfree(w->kcontrol_news[i].name);
>> @@ -1361,6 +1363,7 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_denum_create(
>>   		kfree(se->dobj.control.dvalues);
>>   		for (j = 0; j < ec->items; j++)
>>   			kfree(se->dobj.control.dtexts[j]);
>> +		kfree(se->dobj.control.dtexts);
>>   
>>   		kfree(se);
>>   		kfree(kc[i].name);
> It's interesting that this patch shows three places doing the very
> same thing.  It's worth to make a common helper, I suppose.

Good point indeed, thanks for the suggestion. We'd probably need to dig 
deeper here. There is one loop that uses ce->items and the others 
se->items, the two variables seem similar but we'd need to figure out if 
this is correct.

If that's alright with you I'd prefer to add this helper in a follow-up 
patch.

-Pierre

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2019-01-28 15:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 20:06 [PATCH 0/7] ASoC: topology: fixes and improvements Pierre-Louis Bossart
2019-01-25 20:06 ` [PATCH 1/7] ASoC: topology: Reduce number of dereferences when accessing dobj Pierre-Louis Bossart
2019-01-25 20:06 ` [PATCH 2/7] ASoC: topology: Remove widgets from dobj list Pierre-Louis Bossart
2019-01-25 20:06 ` [PATCH 3/7] ASoC: topology: Fix memory leak from soc_tplg_denum_create_texts Pierre-Louis Bossart
2019-01-26 17:43   ` Takashi Iwai
2019-01-28 15:36     ` Pierre-Louis Bossart [this message]
2019-01-25 20:06 ` [PATCH 4/7] ASoC: topology: fix memory leak in soc_tplg_dapm_widget_create Pierre-Louis Bossart
2019-01-29 18:12   ` Applied "ASoC: topology: fix memory leak in soc_tplg_dapm_widget_create" to the asoc tree Mark Brown
2019-01-25 20:06 ` [PATCH 5/7] ASoC: topology: add SND_SOC_DOBJ_GRAPH type for dapm routes Pierre-Louis Bossart
2019-01-29 18:12   ` Applied "ASoC: topology: add SND_SOC_DOBJ_GRAPH type for dapm routes" to the asoc tree Mark Brown
2019-01-25 20:06 ` [PATCH 6/7] ASoC: topology: modify dapm route loading routine and add dapm route unloading Pierre-Louis Bossart
2019-01-29 18:12   ` Applied "ASoC: topology: modify dapm route loading routine and add dapm route unloading" to the asoc tree Mark Brown
2019-01-25 20:06 ` [PATCH 7/7] ASoC: topology: unload physical dai link in remove Pierre-Louis Bossart
2019-02-01 13:08   ` Pierre-Louis Bossart

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=aa48c0a9-8e5d-9fc8-7f86-21441ed8c833@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@intel.com \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=tiwai@suse.de \
    --cc=vkoul@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).