From 9dbce04402e33e362e3e946c437bc70b8102a95d Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 14 May 2013 15:02:44 +0300 Subject: [PATCH] ASoC: wm_adsp: memory leak in wm_adsp_create_control() There are two return paths which don't kfree(name). Signed-off-by: Dan Carpenter Signed-off-by: Mark Brown --- sound/soc/codecs/wm_adsp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 137830611928..d715c8ede772 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -836,7 +836,8 @@ static int wm_adsp_create_control(struct snd_soc_codec *codec, region_name = "ZM"; break; default: - return -EINVAL; + ret = -EINVAL; + goto err_name; } snprintf(name, PAGE_SIZE, "DSP%d %s %x", @@ -847,7 +848,7 @@ static int wm_adsp_create_control(struct snd_soc_codec *codec, if (!strcmp(ctl->name, name)) { if (!ctl->enabled) ctl->enabled = 1; - return 0; + goto found; } } @@ -887,6 +888,7 @@ static int wm_adsp_create_control(struct snd_soc_codec *codec, INIT_WORK(&ctl_work->work, wm_adsp_ctl_work); schedule_work(&ctl_work->work); +found: kfree(name); return 0; -- 2.39.5