未验证 提交 2b2d5c4d 编写于 作者: D Dragos Tarcatu 提交者: Mark Brown

ASoC: topology: Fix memleak in soc_tplg_link_elems_load()

If soc_tplg_link_config() fails, _link needs to be freed in case of
topology ABI version mismatch. However the current code is returning
directly and ends up leaking memory in this case.
This patch fixes that.

Fixes: 593d9e52 ("ASoC: topology: Add support to configure existing physical DAI links")
Signed-off-by: NDragos Tarcatu <dragos_tarcatu@mentor.com>
Link: https://lore.kernel.org/r/20200207185325.22320-2-dragos_tarcatu@mentor.comSigned-off-by: NMark Brown <broonie@kernel.org>
上级 6c89ffea
......@@ -2376,8 +2376,11 @@ static int soc_tplg_link_elems_load(struct soc_tplg *tplg,
}
ret = soc_tplg_link_config(tplg, _link);
if (ret < 0)
if (ret < 0) {
if (!abi_match)
kfree(_link);
return ret;
}
/* offset by version-specific struct size and
* real priv data size
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册