diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 71bc5b8a9bd3c8eead6b7d94a4bbf4985a9dbe10..2cb0a05e2368d36b2b0502832184ca588c5f3dd7 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1583,6 +1583,9 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg,
 	if (ret < 0)
 		goto ready_err;
 
+	kfree(template.sname);
+	kfree(template.name);
+
 	return 0;
 
 ready_err: