Skip to content

Commit

Permalink
fdtdec: test: Fix memory leak
Browse files Browse the repository at this point in the history
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 <[email protected]>
Suggested-by: Heinrich Schuchardt <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
  • Loading branch information
thierryreding authored and sjg20 committed Jul 10, 2019
1 parent 1edc568 commit 848e94d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/fdtdec_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ static int run_test(const char *aliases, const char *nodes, const char *expect)
}

printf("pass\n");
free(blob);
return 0;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 848e94d

Please sign in to comment.