From: Dragos Tarcatu Date: Fri, 7 Feb 2020 18:53:24 +0000 (+0200) Subject: ASoC: topology: Fix memleak in soc_tplg_link_elems_load() X-Git-Tag: v5.5.9~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=816574df011884f8c7b14eccb6f9238edfce94b6;p=thirdparty%2Fkernel%2Fstable.git ASoC: topology: Fix memleak in soc_tplg_link_elems_load() commit 2b2d5c4db732c027a14987cfccf767dac1b45170 upstream. 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: 593d9e52f9bb ("ASoC: topology: Add support to configure existing physical DAI links") Signed-off-by: Dragos Tarcatu Link: https://lore.kernel.org/r/20200207185325.22320-2-dragos_tarcatu@mentor.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 0119f07cece6f..2b4926ec394da 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -2335,8 +2335,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