瀏覽代碼

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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Dan Carpenter 12 年之前
父節點
當前提交
b5c745fb75
共有 1 個文件被更改,包括 1 次插入3 次删除
  1. 1 3
      sound/soc/soc-core.c

+ 1 - 3
sound/soc/soc-core.c

@@ -3908,10 +3908,8 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
 {
 {
 	/* create platform component name */
 	/* create platform component name */
 	platform->name = fmt_single_name(dev, &platform->id);
 	platform->name = fmt_single_name(dev, &platform->id);
-	if (platform->name == NULL) {
-		kfree(platform);
+	if (platform->name == NULL)
 		return -ENOMEM;
 		return -ENOMEM;
-	}
 
 
 	platform->dev = dev;
 	platform->dev = dev;
 	platform->driver = platform_drv;
 	platform->driver = platform_drv;