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@xxxxxxxxx>
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@xxxxxxxxx>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>
---
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@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel