2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-22 12:14:01 +08:00

ASoC: sgtl5000: use after free in ldo_regulator_register()

The "ldo" variable was dereferenced after free on the error path.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Dan Carpenter 2011-03-08 14:39:24 +03:00 committed by Mark Brown
parent efb7ac3f9c
commit 62f75aafdf

View File

@ -875,11 +875,13 @@ static int ldo_regulator_register(struct snd_soc_codec *codec,
ldo->dev = regulator_register(&ldo->desc, codec->dev,
init_data, ldo);
if (IS_ERR(ldo->dev)) {
int ret = PTR_ERR(ldo->dev);
dev_err(codec->dev, "failed to register regulator\n");
kfree(ldo->desc.name);
kfree(ldo);
return PTR_ERR(ldo->dev);
return ret;
}
return 0;