mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] of: Fix memory hole in of_find_node_by_reproducible_name()
@ 2019-09-12  8:35 Sascha Hauer
  2019-09-12  8:35 ` [PATCH 2/3] of: add of_diff() Sascha Hauer
  2019-09-12  8:35 ` [PATCH 3/3] add of_diff command Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2019-09-12  8:35 UTC (permalink / raw)
  To: Barebox List

of_get_reproducible_name() returns an allocated string, so we must free
it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/of/base.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 838f530f85..22077fa397 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2306,9 +2306,17 @@ struct device_node *of_find_node_by_reproducible_name(struct device_node *from,
 {
 	struct device_node *np;
 
-	of_tree_for_each_node_from(np, from)
-		if (!of_node_cmp(of_get_reproducible_name(np), name))
+	of_tree_for_each_node_from(np, from) {
+		char *rep = of_get_reproducible_name(np);
+		int res;
+
+		res = of_node_cmp(rep, name);
+
+		free(rep);
+
+		if (!res)
 			return np;
+	}
 	return NULL;
 }
 
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-12  8:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-12  8:35 [PATCH 1/3] of: Fix memory hole in of_find_node_by_reproducible_name() Sascha Hauer
2019-09-12  8:35 ` [PATCH 2/3] of: add of_diff() Sascha Hauer
2019-09-12  8:35 ` [PATCH 3/3] add of_diff command Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox