[PATCH 2/7] of: overlay: do not leak fixed up path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.fatoum@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux