Commit f8ba14b7 authored by Kamil Duljas's avatar Kamil Duljas Committed by Mark Brown

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: default avatarKamil Duljas <kamil.duljas@gmail.com>
Reviewed-by: default avatarAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20231116224112.2209-2-kamil.duljas@gmail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 31e721fb
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment