Fix this small per-iteration leak with debuginfo:

424 bytes in 4 blocks are definitely lost in loss record 185 of 230
   at 0x4A0645D: malloc (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x5D75CA7: xmalloc (xmalloc.c:147)
   by 0x4ECE9E4: gen_producer_string() (dwarf2out.c:19489)
   by 0x4EDB2C8: dwarf2out_finish(char const*) (dwarf2out.c:24257)
   by 0x532AD3B: compile_file() (toplev.c:623)
   by 0x532D9E1: do_compile() (toplev.c:2020)
   by 0x532DC54: toplev::main(int, char**) (toplev.c:2117)
   by 0x4DE766F: gcc::jit::playback::context::compile() (jit-playback.c:1615)
   by 0x4DD76DA: gcc::jit::recording::context::compile() (jit-recording.c:861)
   by 0x4DD5BD2: gcc_jit_context_compile (libgccjit.c:2014)
   by 0x401CA4: test_jit (harness.h:190)
   by 0x401D88: main (harness.h:232)

gcc/ChangeLog:
        PR jit/63854
        * dwarf2out.c (dwarf2out_c_finalize): Free producer_string.
---
 gcc/dwarf2out.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index b16883f..9069f9a 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -24741,6 +24741,8 @@ dwarf2out_c_finalize (void)
   frame_pointer_fb_offset = 0;
   frame_pointer_fb_offset_valid = false;
   base_types.release ();
+  XDELETEVEC (producer_string);
+  producer_string = NULL;
 }
 
 #include "gt-dwarf2out.h"
-- 
1.8.5.3

Reply via email to