regmap: Fix memory leak in regmap_init error path
Subsystems (2)
PATCH 1/1 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 <[email protected]>
--- drivers/base/regmap/regmap.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/base/regmap/regmap.c +3 -1
@@ -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:
Signature · 1 line
1.7.7.1
Mark Brown
AppliedQuoted 4 lines · Lars-Peter Clausen
If regcache initialization fails
regmap_initwill currently exit without freeingwork_buf.Signed-off-by Lars-Peter Clausen <[email protected]>
Applied, thanks.