Skip to content

Commit

Permalink
ASoC: core: double free in snd_soc_add_platform()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Mark Brown committed Jul 22, 2013
1 parent 3b2f64d commit b5c745f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b5c745f

Please sign in to comment.