summaryrefslogtreecommitdiff
path: root/lib/fdtdec_test.c
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2019-05-20 19:05:04 +0300
committerSimon Glass <sjg@chromium.org>2019-07-11 01:52:58 +0300
commit848e94d0ba7296d81e3c00b01bad1c13741497fb (patch)
treebfdd8240b436f9846bb9c5ae2233ef94744f4c87 /lib/fdtdec_test.c
parent1edc5688df70ee3ddb692ef3429ac28ed8666a4b (diff)
downloadu-boot-848e94d0ba7296d81e3c00b01bad1c13741497fb.tar.xz
fdtdec: test: Fix memory leak
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> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/fdtdec_test.c')
-rw-r--r--lib/fdtdec_test.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/fdtdec_test.c b/lib/fdtdec_test.c
index 1f4f270540..e8bfd1fb1e 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;
}
@@ -292,6 +293,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;
}