Skip to contentSkip to conversation

ASoC: core: double free in snd_soc_add_platform()

PATCH Applied Dan Carpenter 2 participants 2 messages Jul 22, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: core: double free in snd_soc_add_platform()

There are three callers for this function, and none of them want it to free platform for them. It leads to a double free.

sound/soc/soc-core.c +1 -3
index 0ec070c..d82ee38 100644
@@ -3908,10 +3908,8 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
 {
 	/* create platform component name */
 	platform->name = fmt_single_name(dev, &platform->id);
-	if (platform->name = NULL) {
-		kfree(platform);
+	if (platform->name = NULL)
 		return -ENOMEM;
-	}
 
 	platform->dev = dev;
 	platform->driver = platform_drv;
maintainer Applied
#1 lore raw
Quoted 2 lines · Dan Carpenter

There are three callers for this function, and none of them want it to free platform for them. It leads to a double free.

Applied, thanks.