ASoC: topology: Fix memory leak in widget creation
authorJeeja KP <jeeja.kp@intel.com>
Thu, 5 May 2016 05:49:18 +0000 (11:19 +0530)
committerMark Brown <broonie@kernel.org>
Thu, 5 May 2016 15:46:29 +0000 (16:46 +0100)
name and sname allocated in widget create are not freed when
creation is successful, so free them.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-topology.c

index 29ae3d3a0f8a75157137f1daab5281542f48bd22..ee7f15aa46fca30400a07d8b8cf4f44717f0a89f 100644 (file)
@@ -1481,6 +1481,8 @@ widget:
        widget->dobj.type = SND_SOC_DOBJ_WIDGET;
        widget->dobj.ops = tplg->ops;
        widget->dobj.index = tplg->index;
+       kfree(template.sname);
+       kfree(template.name);
        list_add(&widget->dobj.list, &tplg->comp->dobj_list);
        return 0;