ASoC: wm_adsp: memory leak in wm_adsp_create_control()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 14 May 2013 12:02:44 +0000 (15:02 +0300)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 14 May 2013 12:39:59 +0000 (16:39 +0400)
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>
sound/soc/codecs/wm_adsp.c

index 137830611928115742e7f7842c7a03c99e5b506e..d715c8ede772c6047a3a59723637a66cbb488de7 100644 (file)
@@ -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;