ASoC: core: double free in snd_soc_add_platform()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 22 Jul 2013 06:56:54 +0000 (09:56 +0300)
committerMark Brown <broonie@linaro.org>
Mon, 22 Jul 2013 10:00:05 +0000 (11:00 +0100)
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>
sound/soc/soc-core.c

index 0ec070cf7231ebcc39a057061af8995d7f7574ff..d82ee386eab564d352eccd4209dff767b222e6f3 100644 (file)
@@ -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;