提交 513cb311 编写于 作者: S Sudip Mukherjee 提交者: Mark Brown

ASoC: fix memory leak

If dai_link is already bound then we just returned and leaked rtd and
rtd->codec_dais which were allocated by soc_new_pcm_runtime(). We do not
need this newly allocated rtd to check if dai_link is already binded. Lets
check first if it is already binded before allocating this memory.
Signed-off-by: NSudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 92e963f5
......@@ -986,16 +986,16 @@ static int soc_bind_dai_link(struct snd_soc_card *card,
dev_dbg(card->dev, "ASoC: binding %s\n", dai_link->name);
rtd = soc_new_pcm_runtime(card, dai_link);
if (!rtd)
return -ENOMEM;
if (soc_is_dai_link_bound(card, dai_link)) {
dev_dbg(card->dev, "ASoC: dai link %s already bound\n",
dai_link->name);
return 0;
}
rtd = soc_new_pcm_runtime(card, dai_link);
if (!rtd)
return -ENOMEM;
cpu_dai_component.name = dai_link->cpu_name;
cpu_dai_component.of_node = dai_link->cpu_of_node;
cpu_dai_component.dai_name = dai_link->cpu_dai_name;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册