aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-03-14 20:18:49 +0000
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-03-15 14:28:25 +0000
commit181a68927b9e6ff7c0ea093c2f056eeb0552a911 (patch)
tree5e897ae095713dea4085908dd5c9f3519e3e9c51 /sound
parent4eb98f45b77b00868dcebe4a0f00d2a36afd88c2 (diff)
ASoC: core: Fix obscure leak of runtime array
We're currently not freeing card->rtd in cases where the card is unregistered before being instantiated - convert it to devm_kzalloc() to make sure that happens. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-core.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 93a0daac508..a4deebc0801 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1686,7 +1686,6 @@ static int soc_cleanup_card_resources(struct snd_soc_card *card)
snd_soc_dapm_free(&card->dapm);
- kfree(card->rtd);
snd_card_free(card->snd_card);
return 0;
@@ -3112,9 +3111,10 @@ int snd_soc_register_card(struct snd_soc_card *card)
soc_init_card_debugfs(card);
- card->rtd = kzalloc(sizeof(struct snd_soc_pcm_runtime) *
- (card->num_links + card->num_aux_devs),
- GFP_KERNEL);
+ card->rtd = devm_kzalloc(card->dev,
+ sizeof(struct snd_soc_pcm_runtime) *
+ (card->num_links + card->num_aux_devs),
+ GFP_KERNEL);
if (card->rtd == NULL)
return -ENOMEM;
card->rtd_aux = &card->rtd[card->num_links];