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>
This commit is contained in:
Dan Carpenter 2013-07-22 09:56:54 +03:00 committed by Mark Brown
parent 3b2f64d00c
commit b5c745fb75
1 changed files with 1 additions and 3 deletions

View 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;