[PATCH] regulator: fix memory leak

Andrej Picej andrej.picej at norik.com
Fri Nov 19 05:06:23 PST 2021


Fix memory leak of propname.

Signed-off-by: Andrej Picej <andrej.picej at norik.com>
---
 drivers/regulator/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 097f7d779..c5cb9ee34 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -231,8 +231,10 @@ static struct regulator_internal *of_regulator_get(struct device_d *dev, const c
 	}
 
 	ret = of_device_ensure_probed(node);
-	if (ret)
-		return ERR_PTR(ret);
+	if (ret) {
+		ri = ERR_PTR(ret);
+		goto out;
+	}
 
 	list_for_each_entry(ri, &regulator_list, list) {
 		if (ri->node == node) {
-- 
2.25.1




More information about the barebox mailing list