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>
This commit is contained in:
Kamil Duljas 2023-11-16 13:51:50 +01:00 committed by Mark Brown
parent 37e6fd0ceb
commit d5c65be34d
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
2 changed files with 6 additions and 2 deletions

View File

@ -240,8 +240,10 @@ static int skl_pcm_open(struct snd_pcm_substream *substream,
snd_pcm_set_sync(substream);
mconfig = skl_tplg_fe_get_cpr_module(dai, substream->stream);
if (!mconfig)
if (!mconfig) {
kfree(dma_params);
return -EINVAL;
}
skl_tplg_d0i3_get(skl, mconfig->d0i3_caps);

View File

@ -1003,8 +1003,10 @@ int skl_ipc_get_large_config(struct sst_generic_ipc *ipc,
reply.size = (reply.header >> 32) & IPC_DATA_OFFSET_SZ_MASK;
buf = krealloc(reply.data, reply.size, GFP_KERNEL);
if (!buf)
if (!buf) {
kfree(reply.data);
return -ENOMEM;
}
*payload = buf;
*bytes = reply.size;