From: Charles Keepax Date: Thu, 11 Aug 2016 13:39:00 +0000 (+0100) Subject: ASoC: Fix leak of rtd in soc_bind_dai_link X-Git-Tag: v4.14-rc1~2519^2~10^2~5^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=70fcad495b9903d362bdbf9ffba23259294064c8;p=platform%2Fkernel%2Flinux-rpi.git ASoC: Fix leak of rtd in soc_bind_dai_link If we fail to find a platform we simply return EPROBE_DEFER, but we have allocated the rtd pointer. All error paths before soc_add_pcm_runtime need to call soc_free_pcm_runtime first to avoid leaking the rtd pointer. A suitable error path already exists and is used else where in the function so simply use that here as well. Signed-off-by: Charles Keepax Signed-off-by: Mark Brown --- diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 16369ca..b0e23db 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1056,7 +1056,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, if (!rtd->platform) { dev_err(card->dev, "ASoC: platform %s not registered\n", dai_link->platform_name); - return -EPROBE_DEFER; + goto _err_defer; } soc_add_pcm_runtime(card, rtd);