Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: codecs: wcd937x: fix a potential memory leak in wcd937x_soc_codec_probe()

When snd_soc_dapm_new_controls() or snd_soc_dapm_add_routes() fails,
wcd937x_soc_codec_probe() returns without releasing 'wcd937x->clsh_info',
which is allocated by wcd_clsh_ctrl_alloc. Add wcd_clsh_ctrl_free()
to prevent potential memory leak.

Fixes: 313e978df7fc ("ASoC: codecs: wcd937x: add audio routing and Kconfig")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
Link: https://patch.msgid.link/20250226085050.3584898-1-haoxiang_li2024@163.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Haoxiang Li and committed by
Mark Brown
3e330acf ede6445d

+2
+2
sound/soc/codecs/wcd937x.c
··· 2571 2571 ARRAY_SIZE(wcd9375_dapm_widgets)); 2572 2572 if (ret < 0) { 2573 2573 dev_err(component->dev, "Failed to add snd_ctls\n"); 2574 + wcd_clsh_ctrl_free(wcd937x->clsh_info); 2574 2575 return ret; 2575 2576 } 2576 2577 ··· 2579 2578 ARRAY_SIZE(wcd9375_audio_map)); 2580 2579 if (ret < 0) { 2581 2580 dev_err(component->dev, "Failed to add routes\n"); 2581 + wcd_clsh_ctrl_free(wcd937x->clsh_info); 2582 2582 return ret; 2583 2583 } 2584 2584 }