new_path is freshly allocated in every iteration and then leaked after of_property_write_string() takes a copy from it.
Fix the leak by freeing it before it goes out of scope. Signed-off-by: Ahmad Fatoum <a.fat...@pengutronix.de> --- drivers/of/overlay.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index 91b88c3f1b57..867a7a369739 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -151,6 +151,7 @@ static int of_overlay_apply_symbols(struct device_node *root, pr_debug("add symbol %s with new path %s\n", prop->name, new_path); of_property_write_string(root_symbols, prop->name, new_path); + free(new_path); } return 0; -- 2.39.2