summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorKamil Duljas <kamil.duljas@gmail.com>2023-11-17 00:39:17 +0300
committerMark Brown <broonie@kernel.org>2023-11-17 15:47:50 +0300
commit31e721fbd194d5723722eaa21df1d14cee7e12b5 (patch)
tree3bb7f26b0431b84be603d78e1b1badc742fa313e /sound
parentc1501f2597dd08601acd42256a4b0a0fc36bf302 (diff)
downloadlinux-31e721fbd194d5723722eaa21df1d14cee7e12b5.tar.xz
ASoC: SOF: topology: Fix mem leak in sof_dai_load()
The function has multiple return points at which it is not released previously allocated memory. Signed-off-by: Kamil Duljas <kamil.duljas@gmail.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20231116213926.2034-2-kamil.duljas@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/sof/topology.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index a3a3af252259..37ec671a2d76 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -1736,8 +1736,10 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
/* perform pcm set op */
if (ipc_pcm_ops && ipc_pcm_ops->pcm_setup) {
ret = ipc_pcm_ops->pcm_setup(sdev, spcm);
- if (ret < 0)
+ if (ret < 0) {
+ kfree(spcm);
return ret;
+ }
}
dai_drv->dobj.private = spcm;