From 62f75aafdf180554b4fad29ff1f3827b151d39db Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 8 Mar 2011 14:39:24 +0300 Subject: 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 Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/codecs/sgtl5000.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sound/soc') diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index b7e97c026898..1f7217f703ee 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -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; -- cgit v1.2.1