bug-binutils
[Top][All Lists]
Advanced

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

potential memory leak in file dwarf2.c in binutils-2.22


From: Zhenbo Xu
Subject: potential memory leak in file dwarf2.c in binutils-2.22
Date: Tue, 20 Mar 2012 16:16:27 +0800

Hi all,
I wonder if this is a memory leak at the following code embedded with description.

file: bfd/dwarf2.c

static bfd_boolean
scan_unit_for_symbols(struct comp_unit *unit) {
 ...
 //line 2149
 for (i = 0; i < abbrev->num_attrs; ++i) {
   info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr);
 if (info_ptr == NULL)
   goto fail;

 if (func)
   {
     switch (attr.name) {
       case DW_AT_call_file:
         //Should we free func->caller_file before this assignment,
         //Since attr.name may be "DW_AT_call_file" twice?
         //The fix may be:
         // if (func->caller_file) free(func->caller_file);

         func->caller_file = concat_filename (unit->line_table,
                                              attr.u.val);
         break;
         ...
       }
 }
}

--
Zhenbo Xu

reply via email to

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