From: Gustavo A. R. Silva Date: Fri, 3 Aug 2018 13:42:11 +0000 (-0500) Subject: ASoC: smd845: fix memory leak X-Git-Tag: v4.19~92^2~2^2~56 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8530ebf1079ccc84ffa32d970cdcae168b2f3684;p=platform%2Fkernel%2Flinux-rpi3.git ASoC: smd845: fix memory leak 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 Signed-off-by: Mark Brown --- 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 @@ register_card_fail: kfree(card->dai_link); parse_dt_fail: kfree(data); +data_alloc_fail: kfree(card); return ret; }