ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids
Subsystems (3)
PATCH 1/1 ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids
In snd_skl_parse_uuids if allocation for module->instance_id fails, the allocated memory for module shoulde be released.
Signed-off-by Navid Emamdoost <[email protected]>
--- sound/soc/intel/skylake/skl-sst-utils.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/intel/skylake/skl-sst-utils.c +1 -0
@@ -299,6 +299,7 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw, module->instance_id =devm_kzalloc (ctx->dev, size,GFP_KERNEL );if (!module->instance_id) { ret = -ENOMEM ; +kfree (module); goto free_uuid_list; }
Signature · 1 line
2.17.1
Quoted 2 lines · Navid Emamdoost
In
snd_skl_parse_uuidsif allocation formodule->instance_idfails, the allocated memory for module shoulde be released.
Since it's using devm_*() for the second allocation it would be cleaner to either switch it to regular kcalloc() or to switch the first one to devm_kzalloc(), whatever suits better.
Quoted 4 lines
sound/soc/intel/skylake/skl-sst-utils.c +1
-0module->instance_id =devm_kzalloc (ctx->dev, size,GFP_KERNEL );if (!module->instance_id) { +kfree (module);
Signature · 2 lines
With Best Regards, Andy Shevchenko