]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
ASoC: dapm: Fix kcontrol widget name memory management
authorLars-Peter Clausen <lars@metafoo.de>
Wed, 8 Jul 2015 19:59:59 +0000 (21:59 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 8 Jul 2015 21:16:12 +0000 (22:16 +0100)
commite18077b6e5dfe26e9fbbdc1fd1085a1701c24bea
treef4c0c644bb06cdc9a93c730f28a74485ac615630
parente50b1e06b79e9d51efbff9627b4dd407184ef43f
ASoC: dapm: Fix kcontrol widget name memory management

The name field of the widget template is only used inside
snd_soc_dapm_new_control_unlocked() which allocates a copy for the actual
widget. This means we need to free the name allocated for the template in
dapm_kcontrol_data_alloc() and not the name of the actual widget in
dapm_kcontrol_free(). Otherwise we get a double free on the widget name and
a memory leak on the template name.

Fixes: 773da9b358bf ("ASoC: dapm: Append "Autodisable" to autodisable widget names")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-dapm.c