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

From: Navid Emamdoost
Date: Wed Sep 25 2019 - 00:08:54 EST


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 <navid.emamdoost@xxxxxxxxx>
---
sound/soc/intel/skylake/skl-sst-utils.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
index d43cbf4a71ef..d4db64d72b2c 100644
--- a/sound/soc/intel/skylake/skl-sst-utils.c
+++ b/sound/soc/intel/skylake/skl-sst-utils.c
@@ -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;
}

--
2.17.1