Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 70fcad49 authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown
Browse files

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: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 29b4817d
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1056,7 +1056,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card,
	if (!rtd->platform) {
	if (!rtd->platform) {
		dev_err(card->dev, "ASoC: platform %s not registered\n",
		dev_err(card->dev, "ASoC: platform %s not registered\n",
			dai_link->platform_name);
			dai_link->platform_name);
		return -EPROBE_DEFER;
		goto _err_defer;
	}
	}


	soc_add_pcm_runtime(card, rtd);
	soc_add_pcm_runtime(card, rtd);