* [PATCH] ASoC: smd845: fix memory leak
@ 2018-08-03 13:42 Gustavo A. R. Silva
0 siblings, 0 replies; only message in thread
From: Gustavo A. R. Silva @ 2018-08-03 13:42 UTC (permalink / raw)
To: Rohit kumar, Patrick Lai, Banajit Goswami, Liam Girdwood,
Mark Brown, Jaroslav Kysela, Takashi Iwai
Cc: alsa-devel, linux-kernel, Gustavo A. R. Silva
In case memory resources for *card* were allocated, release them before
return.
Addresses-Coverity-ID: 1472244 ("Resource leak")
Fixes: 6b1687bf76ef ("ASoC: qcom: add sdm845 sound card support")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
NOTE: Notice that there are many places in which the return values of
functions snd_soc_dai_set_sysclk() and snd_soc_dai_set_fmt() are
not being checked. I wonder if this is intentional. Otherwise, I
can send a patch for that. Please, confirm. Thanks!
sound/soc/qcom/sdm845.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c
index be0cb11..c1adb77 100644
--- a/sound/soc/qcom/sdm845.c
+++ b/sound/soc/qcom/sdm845.c
@@ -222,8 +222,10 @@ static int sdm845_snd_platform_probe(struct platform_device *pdev)
/* Allocate the private data */
data = kzalloc(sizeof(*data), GFP_KERNEL);
- if (!data)
- return -ENOMEM;
+ if (!data) {
+ ret = -ENOMEM;
+ goto data_alloc_fail;
+ }
card->dev = dev;
dev_set_drvdata(dev, card);
@@ -248,6 +250,7 @@ static int sdm845_snd_platform_probe(struct platform_device *pdev)
kfree(card->dai_link);
parse_dt_fail:
kfree(data);
+data_alloc_fail:
kfree(card);
return ret;
}
--
2.7.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-08-03 13:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-03 13:42 [PATCH] ASoC: smd845: fix memory leak Gustavo A. R. Silva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox