[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1320945315-2745-1-git-send-email-lars@metafoo.de>
Date: Thu, 10 Nov 2011 18:15:15 +0100
From: Lars-Peter Clausen <lars@...afoo.de>
To: Mark Brown <broonie@...nsource.wolfsonmicro.com>
CC: Dimitris Papastamos <dp@...nsource.wolfsonmicro.com>,
<linux-kernel@...r.kernel.org>,
Lars-Peter Clausen <lars@...afoo.de>
Subject: [PATCH] regmap: Fix memory leak in regmap_init error path
If regcache initialization fails regmap_init will currently exit without
freeing work_buf.
Signed-off-by: Lars-Peter Clausen <lars@...afoo.de>
---
drivers/base/regmap/regmap.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 3e30d16..b08df85 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -229,12 +229,14 @@ struct regmap *regmap_init(struct device *dev,
ret = regcache_init(map);
if (ret < 0)
- goto err_map;
+ goto err_free_workbuf;
regmap_debugfs_init(map);
return map;
+err_free_workbuf:
+ kfree(map->work_buf);
err_map:
kfree(map);
err:
--
1.7.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists