diff mbox

[1/2] ASoC: topology: Fix memory leak in widget creation

Message ID 1462427359-30402-2-git-send-email-vinod.koul@intel.com (mailing list archive)
State Accepted
Commit 8ea416748bb04b7a778cb8d2fd5ec7fa51b9d521
Headers show

Commit Message

Vinod Koul May 5, 2016, 5:49 a.m. UTC
From: Jeeja KP <jeeja.kp@intel.com>

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>
---
 sound/soc/soc-topology.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox

Patch

diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 1cf94d7fb9f4..ff95c3a7b8a3 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1476,6 +1476,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;