public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] fdtdec: test: Fix memory leak
@ 2019-05-20 16:05 Thierry Reding
  2019-05-20 16:05 ` [U-Boot] [PATCH 2/2] fdtdec: Remove fdt_{addr,size}_unpack() Thierry Reding
  2019-05-20 20:51 ` [U-Boot] [PATCH 1/2] fdtdec: test: Fix memory leak Simon Glass
  0 siblings, 2 replies; 7+ messages in thread
From: Thierry Reding @ 2019-05-20 16:05 UTC (permalink / raw)
  To: u-boot

From: Thierry Reding <treding@nvidia.com>

Free the memory allocated to store the test FDT upon test completion to
avoid leaking the memory. We don't bother cleaning up on test failure
since the code is broken in that case and should be fixed, in which case
the leak would also go away.

Reported-by: Tom Rini <tom.rini@gmail.com>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 lib/fdtdec_test.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/fdtdec_test.c b/lib/fdtdec_test.c
index f6defe16c5a6..54efcc3d46ac 100644
--- a/lib/fdtdec_test.c
+++ b/lib/fdtdec_test.c
@@ -138,6 +138,7 @@ static int run_test(const char *aliases, const char *nodes, const char *expect)
 	}
 
 	printf("pass\n");
+	free(blob);
 	return 0;
 }
 
@@ -288,6 +289,7 @@ static int check_carveout(void)
 	CHECKVAL(make_fdt_carveout(fdt, FDT_SIZE, 2, 2), 0);
 	CHECKOK(check_fdt_carveout(fdt, 2, 2));
 
+	free(fdt);
 	return 0;
 }
 
-- 
2.21.0

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

end of thread, other threads:[~2019-06-28 13:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-20 16:05 [U-Boot] [PATCH 1/2] fdtdec: test: Fix memory leak Thierry Reding
2019-05-20 16:05 ` [U-Boot] [PATCH 2/2] fdtdec: Remove fdt_{addr,size}_unpack() Thierry Reding
2019-05-22 13:21   ` Simon Glass
2019-05-20 20:51 ` [U-Boot] [PATCH 1/2] fdtdec: test: Fix memory leak Simon Glass
2019-05-21 10:21   ` Thierry Reding
2019-05-21 16:43     ` Simon Glass
2019-06-28 13:54       ` Simon Glass

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