All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: core: Fix obscure leak of runtime array
@ 2012-03-14 21:20 Mark Brown
  2012-03-14 21:20 ` [PATCH 3.5 2/2] ASoC: core: Use driver core probe deferral Mark Brown
  2012-03-15  9:31 ` [PATCH 1/2] ASoC: core: Fix obscure leak of runtime array Liam Girdwood
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Brown @ 2012-03-14 21:20 UTC (permalink / raw)
  To: Liam Girdwood, Grant Likely; +Cc: alsa-devel, patches, Mark Brown

We're currently not freeing card->rtd in cases where the card is
unregistered before being registered - convert it to devm_kzalloc() to
make sure that happens.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/soc-core.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 9a7ca0e..b0f8666 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1694,7 +1694,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;
 
@@ -3120,9 +3119,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];
-- 
1.7.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-15  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-14 21:20 [PATCH 1/2] ASoC: core: Fix obscure leak of runtime array Mark Brown
2012-03-14 21:20 ` [PATCH 3.5 2/2] ASoC: core: Use driver core probe deferral Mark Brown
2012-03-15  9:31 ` [PATCH 1/2] ASoC: core: Fix obscure leak of runtime array Liam Girdwood

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.