* [PATCH] ASoC: wm0010: fix memory leak
@ 2015-09-01 5:44 Sudip Mukherjee
2015-09-01 8:29 ` Charles Keepax
0 siblings, 1 reply; 2+ messages in thread
From: Sudip Mukherjee @ 2015-09-01 5:44 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
Cc: linux-kernel, patches, alsa-devel, Sudip Mukherjee
We were aborting if the kzalloc of img_swap fails but without freeing the
already allocated out. Similarly we were aborting if spi_sync fails
without releasing out and img_swap.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
sound/soc/codecs/wm0010.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/wm0010.c b/sound/soc/codecs/wm0010.c
index f2c6ad4..8434d45 100644
--- a/sound/soc/codecs/wm0010.c
+++ b/sound/soc/codecs/wm0010.c
@@ -672,8 +672,10 @@ static int wm0010_boot(struct snd_soc_codec *codec)
}
img_swap = kzalloc(len, GFP_KERNEL | GFP_DMA);
- if (!img_swap)
+ if (!img_swap) {
+ kfree(out);
goto abort;
+ }
/* We need to re-order for 0010 */
byte_swap_64((u64 *)&pll_rec, img_swap, len);
@@ -690,6 +692,8 @@ static int wm0010_boot(struct snd_soc_codec *codec)
ret = spi_sync(spi, &m);
if (ret != 0) {
dev_err(codec->dev, "First PLL write failed: %d\n", ret);
+ kfree(img_swap);
+ kfree(out);
goto abort;
}
@@ -697,6 +701,8 @@ static int wm0010_boot(struct snd_soc_codec *codec)
ret = spi_sync(spi, &m);
if (ret != 0) {
dev_err(codec->dev, "Second PLL write failed: %d\n", ret);
+ kfree(img_swap);
+ kfree(out);
goto abort;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ASoC: wm0010: fix memory leak
2015-09-01 5:44 [PATCH] ASoC: wm0010: fix memory leak Sudip Mukherjee
@ 2015-09-01 8:29 ` Charles Keepax
0 siblings, 0 replies; 2+ messages in thread
From: Charles Keepax @ 2015-09-01 8:29 UTC (permalink / raw)
To: Sudip Mukherjee
Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
linux-kernel, patches, alsa-devel
On Tue, Sep 01, 2015 at 11:14:05AM +0530, Sudip Mukherjee wrote:
> We were aborting if the kzalloc of img_swap fails but without freeing the
> already allocated out. Similarly we were aborting if spi_sync fails
> without releasing out and img_swap.
>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-01 8:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-01 5:44 [PATCH] ASoC: wm0010: fix memory leak Sudip Mukherjee
2015-09-01 8:29 ` Charles Keepax
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox