summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorDragos Tarcatu <dragos_tarcatu@mentor.com>2020-02-07 20:53:24 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-03-12 13:00:25 +0100
commita6e3b2aedf8af18693c488bcf65c53bef7d46941 (patch)
tree5ed0d4e7b81dcab79762f182e1b12e279066162b /sound
parent9998ebb5e73c72ba11a025434be9c2ff1c33b1f0 (diff)
downloadlinux-stable-a6e3b2aedf8af18693c488bcf65c53bef7d46941.tar.gz
linux-stable-a6e3b2aedf8af18693c488bcf65c53bef7d46941.tar.bz2
linux-stable-a6e3b2aedf8af18693c488bcf65c53bef7d46941.zip
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 <dragos_tarcatu@mentor.com> Link: https://lore.kernel.org/r/20200207185325.22320-2-dragos_tarcatu@mentor.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-topology.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index d00203ef8305..35a7141fed7a 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -2320,8 +2320,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