* [PATCH] regmap: Fix memory leak in regmap_init error path
@ 2011-11-10 17:15 Lars-Peter Clausen
2011-11-10 17:41 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Lars-Peter Clausen @ 2011-11-10 17:15 UTC (permalink / raw)
To: Mark Brown; +Cc: Dimitris Papastamos, linux-kernel, Lars-Peter Clausen
If regcache initialization fails regmap_init will currently exit without
freeing work_buf.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] regmap: Fix memory leak in regmap_init error path
2011-11-10 17:15 [PATCH] regmap: Fix memory leak in regmap_init error path Lars-Peter Clausen
@ 2011-11-10 17:41 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2011-11-10 17:41 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: Dimitris Papastamos, linux-kernel
On Thu, Nov 10, 2011 at 06:15:15PM +0100, Lars-Peter Clausen wrote:
> If regcache initialization fails regmap_init will currently exit without
> freeing work_buf.
>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-10 17:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-10 17:15 [PATCH] regmap: Fix memory leak in regmap_init error path Lars-Peter Clausen
2011-11-10 17:41 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox