Skip to content

Commit 2b2d5c4

Browse files
Dragos Tarcatubroonie
authored andcommitted
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: 593d9e5 ("ASoC: topology: Add support to configure existing physical DAI links") Signed-off-by: Dragos Tarcatu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 6c89ffe commit 2b2d5c4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sound/soc/soc-topology.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2376,8 +2376,11 @@ static int soc_tplg_link_elems_load(struct soc_tplg *tplg,
23762376
}
23772377

23782378
ret = soc_tplg_link_config(tplg, _link);
2379-
if (ret < 0)
2379+
if (ret < 0) {
2380+
if (!abi_match)
2381+
kfree(_link);
23802382
return ret;
2383+
}
23812384

23822385
/* offset by version-specific struct size and
23832386
* real priv data size

0 commit comments

Comments
 (0)