diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2013-05-14 08:02:44 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-05-14 08:39:59 -0400 |
commit | 9dbce04402e33e362e3e946c437bc70b8102a95d (patch) | |
tree | d4606f2b17771f27bbf3e2e3f67f91b6c0acd5a8 | |
parent | 6ab2b7b415441fa46357bef883e1ead086de1387 (diff) |
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 <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | sound/soc/codecs/wm_adsp.c | 6 |
1 files 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, | |||
836 | region_name = "ZM"; | 836 | region_name = "ZM"; |
837 | break; | 837 | break; |
838 | default: | 838 | default: |
839 | return -EINVAL; | 839 | ret = -EINVAL; |
840 | goto err_name; | ||
840 | } | 841 | } |
841 | 842 | ||
842 | snprintf(name, PAGE_SIZE, "DSP%d %s %x", | 843 | snprintf(name, PAGE_SIZE, "DSP%d %s %x", |
@@ -847,7 +848,7 @@ static int wm_adsp_create_control(struct snd_soc_codec *codec, | |||
847 | if (!strcmp(ctl->name, name)) { | 848 | if (!strcmp(ctl->name, name)) { |
848 | if (!ctl->enabled) | 849 | if (!ctl->enabled) |
849 | ctl->enabled = 1; | 850 | ctl->enabled = 1; |
850 | return 0; | 851 | goto found; |
851 | } | 852 | } |
852 | } | 853 | } |
853 | 854 | ||
@@ -887,6 +888,7 @@ static int wm_adsp_create_control(struct snd_soc_codec *codec, | |||
887 | INIT_WORK(&ctl_work->work, wm_adsp_ctl_work); | 888 | INIT_WORK(&ctl_work->work, wm_adsp_ctl_work); |
888 | schedule_work(&ctl_work->work); | 889 | schedule_work(&ctl_work->work); |
889 | 890 | ||
891 | found: | ||
890 | kfree(name); | 892 | kfree(name); |
891 | 893 | ||
892 | return 0; | 894 | return 0; |