mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] commands: oftree: fix memory leak
@ 2025-11-27  8:04 Sascha Hauer
  2025-11-28  7:11 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2025-11-27  8:04 UTC (permalink / raw)
  To: Barebox List

The fdt allocated with of_get_flattened_tree() is never freed, add
missing free() after usage.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/oftree.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/commands/oftree.c b/commands/oftree.c
index b172aee9e0..53ca44bb86 100644
--- a/commands/oftree.c
+++ b/commands/oftree.c
@@ -74,6 +74,8 @@ static int do_oftree(int argc, char *argv[])
 
 		ret = write_file(save, fdt, fdt32_to_cpu(fdt->totalsize));
 
+		free(fdt);
+
 		goto out;
 	}
 
-- 
2.47.3




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

end of thread, other threads:[~2025-11-28  7:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-27  8:04 [PATCH] commands: oftree: fix memory leak Sascha Hauer
2025-11-28  7:11 ` Sascha Hauer

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