[patch] ASoC: wm_adsp: memory leak in wm_adsp_create_control()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There are two return paths which don't kfree(name).

Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 1378306..d715c8e 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;
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux