This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 21/21] PR jit/63854: Fix leaks in test-fuzzer.c
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, jit at gcc dot gnu dot org
- Cc: David Malcolm <dmalcolm at redhat dot com>
- Date: Wed, 19 Nov 2014 05:46:21 -0500
- Subject: [PATCH 21/21] PR jit/63854: Fix leaks in test-fuzzer.c
- Authentication-results: sourceware.org; auth=none
- References: <1416393981-39626-1-git-send-email-dmalcolm at redhat dot com>
gcc/testsuite/ChangeLog:
PR jit/63854
* jit.dg/test-fuzzer.c (fuzzer_init): Free malloced buffers.
(make_random_function): Free ff->locals.
---
gcc/testsuite/jit.dg/test-fuzzer.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gcc/testsuite/jit.dg/test-fuzzer.c b/gcc/testsuite/jit.dg/test-fuzzer.c
index f363f8f..b501792 100644
--- a/gcc/testsuite/jit.dg/test-fuzzer.c
+++ b/gcc/testsuite/jit.dg/test-fuzzer.c
@@ -105,6 +105,11 @@ fuzzer_init (fuzzer *f, gcc_jit_context *ctxt, unsigned int seed)
for (i = 0; i < num_funcs; i++)
f->funcs[f->num_funcs++] = make_random_function (f);
+
+ /* Now clean out f. */
+ free (f->types);
+ free (f->funcs);
+ free (f->globals);
}
/* Get random int in inclusive range [min, max]. */
@@ -309,6 +314,7 @@ make_random_function (fuzzer *f)
gcc_jit_function *result = ff->fn;
+ free (ff->locals);
free (ff->params);
free (ff);
--
1.8.5.3