]> git.ipfire.org Git - thirdparty/gcc.git/commit
jit: fix leak of pending_assemble_externals_set [PR117275]
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 29 Oct 2024 12:25:56 +0000 (08:25 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Tue, 29 Oct 2024 12:25:56 +0000 (08:25 -0400)
commit7f41203f08b9948c1c636dc9d66571121c6c7793
tree08b7cfed7120d6ebc6051fa27517614a1c20d82b
parent9999cc79e9866ba33dea0256078f4557d92d80d9
jit: fix leak of pending_assemble_externals_set [PR117275]

My recent r15-4580-g779c0390e3b57d fix for resetting state in
varasm.cc introduced some noise to "make selftest-valgrind" and,
presumably, a memory leak in libgccjit:

==2462086== 160 (56 direct, 104 indirect) bytes in 1 blocks are definitely lost in loss record 248 of 352
==2462086==    at 0x5270E7D: operator new(unsigned long) (vg_replace_malloc.c:342)
==2462086==    by 0x1D1EB89: init_varasm_once() (varasm.cc:6806)
==2462086==    by 0x181C845: backend_init() (toplev.cc:1826)
==2462086==    by 0x181D41A: do_compile() (toplev.cc:2193)
==2462086==    by 0x181D99C: toplev::main(int, char**) (toplev.cc:2371)
==2462086==    by 0x378391D: main (main.cc:39)

Fixed thusly.

gcc/ChangeLog:
PR jit/117275
* varasm.cc (process_pending_assemble_externals): Reset
pending_assemble_externals_set to nullptr after deleting it.
(varasm_cc_finalize): Delete pending_assemble_externals_set.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/varasm.cc