Skip to content

Commit d5c65be

Browse files
KamilDuljasbroonie
authored andcommitted
ASoC: Intel: Skylake: Fix mem leak in few functions
The resources should be freed when function return error. Signed-off-by: Kamil Duljas <kamil.duljas@gmail.com> Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20231116125150.1436-1-kamil.duljas@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 37e6fd0 commit d5c65be

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

sound/soc/intel/skylake/skl-pcm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,10 @@ static int skl_pcm_open(struct snd_pcm_substream *substream,
240240
snd_pcm_set_sync(substream);
241241

242242
mconfig = skl_tplg_fe_get_cpr_module(dai, substream->stream);
243-
if (!mconfig)
243+
if (!mconfig) {
244+
kfree(dma_params);
244245
return -EINVAL;
246+
}
245247

246248
skl_tplg_d0i3_get(skl, mconfig->d0i3_caps);
247249

sound/soc/intel/skylake/skl-sst-ipc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,8 +1003,10 @@ int skl_ipc_get_large_config(struct sst_generic_ipc *ipc,
10031003

10041004
reply.size = (reply.header >> 32) & IPC_DATA_OFFSET_SZ_MASK;
10051005
buf = krealloc(reply.data, reply.size, GFP_KERNEL);
1006-
if (!buf)
1006+
if (!buf) {
1007+
kfree(reply.data);
10071008
return -ENOMEM;
1009+
}
10081010
*payload = buf;
10091011
*bytes = reply.size;
10101012

0 commit comments

Comments
 (0)