ASoC: SOF: topology: Fix memory leak of scontrol->name
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Thu, 31 Mar 2022 11:48:45 +0000 (14:48 +0300)
committerMark Brown <broonie@kernel.org>
Mon, 4 Apr 2022 13:25:38 +0000 (14:25 +0100)
commit5708cc2f4b50c7bf27234eee77e1d9487533bbd3
treedfc25d53f470dcd946d75ba87a19cb8466845b04
parentacc72863e0f11cd0bedc888b663700229f9ba5ff
ASoC: SOF: topology: Fix memory leak of scontrol->name

The scontrol->name is allocated with kstrdup, it must be freed before the
scontrol is freed to avoid leaking memory.

The constant leaking happens via sof_widget_unload() path on every module
removal.

Fixes: b5cee8feb1d48 ("ASoC: SOF: topology: Make control parsing IPC agnostic")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220331114845.32747-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/topology.c