bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Memory leak in dwarf2.c


From: Torsten Rupp
Subject: Memory leak in dwarf2.c
Date: Sun, 1 Sep 2019 22:27:03 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

Dear developers,

I detected (with the help of valgrind) a memory leak in dwarf2.c of
binutils 2.32:

In function_bfd_dwarf2_slurp_debug_info(), line 4367 the following call
is made for the scoped variable debug_filename:

      debug_filename = bfd_follow_build_id_debuglink (abfd, DEBUGDIR);

The returned value is allocated, but this memory is not freed in that
scope in all cases. I can fix the leak if I add at the end of the scope
after the lines (4393):

      symbols = bfd_get_outsymbols (debug_bfd);
      stash->syms = symbols;
      stash->close_on_cleanup = TRUE;

a call to:

      free (debug_filename);

Hopefully you will be able to add this fix in the next release of binutils.

Sincerly,

Torsten Rupp



reply via email to

[Prev in Thread] Current Thread [Next in Thread]