aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Duljas <[email protected]>2023-11-16 23:41:13 +0100
committerMark Brown <[email protected]>2023-11-17 12:47:51 +0000
commitf8ba14b780273fd290ddf7ee0d7d7decb44cc365 (patch)
tree6ad43295ed2fdff701d63b11e5e857c56aa7179d
parent31e721fbd194d5723722eaa21df1d14cee7e12b5 (diff)
ASoC: Intel: Skylake: mem leak in skl register function
skl_platform_register() uses krealloc. When krealloc is fail, then previous memory is not freed. The leak is also when soc component registration failed. Signed-off-by: Kamil Duljas <[email protected]> Reviewed-by: Amadeusz Sławiński <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
-rw-r--r--sound/soc/intel/skylake/skl-pcm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 18866bc415a5..174aae6e0398 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -1464,6 +1464,7 @@ int skl_platform_register(struct device *dev)
dais = krealloc(skl->dais, sizeof(skl_fe_dai) +
sizeof(skl_platform_dai), GFP_KERNEL);
if (!dais) {
+ kfree(skl->dais);
ret = -ENOMEM;
goto err;
}
@@ -1476,8 +1477,10 @@ int skl_platform_register(struct device *dev)
ret = devm_snd_soc_register_component(dev, &skl_component,
skl->dais, num_dais);
- if (ret)
+ if (ret) {
+ kfree(skl->dais);
dev_err(dev, "soc component registration failed %d\n", ret);
+ }
err:
return ret;
}