bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/868] bfd leaks memory in several places


From: diogo at kraemer dot eng dot br
Subject: [Bug binutils/868] bfd leaks memory in several places
Date: 14 Feb 2008 18:13:17 -0000

------- Additional Comments From diogo at kraemer dot eng dot br  2008-02-14 
18:13 -------
 I'm using the utiliy from http://www.plunk.org/~hatch/goodies/backtracefilt.C
to translate de stack back trace into a readable trace.
 It says in its comment on line 1044 that bfd_find_nearest_line (in
binutils-2.15.92.0.2-13) has a memory leak bug. I donwloaded the last
binutils-2.18 and noted that the bug is still there.
 By debugging the bfd library I found the bug in dwar2.c module: the function
scan_unit_for_symbols allocates memory for the function and variable file names,
and doesn't deallocates it.
 As a suggestion for a fix I'd add the following lines into the for loop of the
_bfd_dwarf2_cleanup_debug_info function:

for (each = stash->all_comp_units; each; each = each->next_unit)
   {
       struct funcinfo *function_table = each->function_table;
       struct varinfo *variable_table = each->variable_table;

       /* ...
       * other deallocation stuff already done
       * ...
       */

       while (function_table)
       {
           if (function_table->file)
           {
               free(function_table->file);
               function_table->file = NULL;
           }
           function_table = function_table->prev_func;
       }
       while (variable_table)
       {
           if (variable_table->file)
           {
               free(variable_table->file);
               variable_table->file = NULL;
           }
           variable_table = variable_table->prev_var;
       }
   }

 I hope this is the correct fix and wait forward for its availability in a
future version soon.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=868

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

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