Re: [PATCH] ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids

From: Andy Shevchenko
Date: Wed Sep 25 2019 - 06:48:58 EST


On Tue, Sep 24, 2019 at 11:08:38PM -0500, Navid Emamdoost wrote:
> In snd_skl_parse_uuids if allocation for module->instance_id fails, 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.

> module->instance_id = devm_kzalloc(ctx->dev, size, GFP_KERNEL);
> if (!module->instance_id) {

> + kfree(module);

--
With Best Regards,
Andy Shevchenko