From 235f6f74212edf620cb2a3c41975554fde16f49b Mon Sep 17 00:00:00 2001 From: Kragen Javier Sitaker <kragen@canonical.org> Date: Sat, 26 Oct 2019 22:01:32 -0300 Subject: [PATCH] Fix noise memory leak in examples/base64.c Obviously we don't care if examples/base64.c leaks memory before exiting, but things like that are noise that make it hard to tell if there's a real memory-leak problem somewhere else; it also sets a bad example for code that someone might write modeled on the example. This patch ensures that the example frees its allocations as it should. --- examples/base64.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/base64.c b/examples/base64.c index 4b7dd9f1..7fe3cffb 100644 --- a/examples/base64.c +++ b/examples/base64.c @@ -70,6 +70,8 @@ void assert_parse(int expected, char *data) { h_pprint(stdout, result->ast, 0, 0); } #endif + + h_parse_result_free(result); } void test() { @@ -107,6 +109,7 @@ int main(int argc, char **argv) if(result) { fprintf(stderr, "parsed=%" PRId64 " bytes\n", result->bit_length/8); h_pprint(stdout, result->ast, 0, 0); + h_parse_result_free(result); return 0; } else { return 1; -- GitLab