[alsa-devel] [PATCH] ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids

Andy Shevchenko andriy.shevchenko at linux.intel.com
Wed Sep 25 12:48:51 CEST 2019


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




More information about the Alsa-devel mailing list