This is the mail archive of the
mailing list for the GCC project.
coverage.c: Fix leak of da_file_name
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 09 Oct 2013 20:18:22 -0400
- Subject: coverage.c: Fix leak of da_file_name
- Authentication-results: sourceware.org; auth=none
coverage_init allocates da_file_name using XNEWVEC, but it is never
freed. This shows up as a slow memory leak in my JIT code when
repeatedly invoking the compiler code within a single process.
This patch frees it in coverage_finish with XDELETEVEC (and NULLs it to
Bootstrapped and regtested against trunk on x86_64-unknown-linux.
OK for trunk?
(Seen using valgrind; I've already committed this on my dmalcolm/jit
Author: David Malcolm <firstname.lastname@example.org>
Date: Wed Oct 9 13:47:13 2013 -0400
Fix leak of coverage.c:da_file_name
* coverage.c (coverage_finish): Fix leak of da_file_name.
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 9bc23c4..3c36c6f 100644
@@ -1209,6 +1209,9 @@ coverage_finish (void)
fn_ctor = coverage_obj_fn (fn_ctor, fn->fn_decl, fn);
+ XDELETEVEC (da_file_name);
+ da_file_name = NULL;