elfcode.h memory leak?

Doug Evans dje@transmeta.com
Fri Mar 23 20:49:00 GMT 2001


elf_slurp_symbol_table has this:

      symbase = ((elf_symbol_type *)
		 bfd_zalloc (abfd, symcount * sizeof (elf_symbol_type)));

Who's responsibility is it to free `symbase'?

bfd_canonicalize_symtab returns an array of pointers into this.
But I don't see where the actual symbol array is freed.
It isn't recorded anywhere for someone to free.

Is one supposed to just know that the first symbol pointer is a
pointer to the head of the malloc'd chunk and therefore can be
passed to free()?  Rather clumsy and fragile, so I'm guessing
I'm overlooking something.



More information about the Binutils mailing list