This is the mail archive of the
mailing list for the binutils project.
elfcode.h memory leak?
- To: binutils at sourceware dot cygnus dot com
- Subject: elfcode.h memory leak?
- From: Doug Evans <dje at transmeta dot com>
- Date: Fri, 23 Mar 2001 20:59:15 -0800 (PST)
- References: <200103240448.UAA01874@casey.transmeta.com>
Doug Evans writes:
> 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.
Ok, digging a bit deeper, it's allocated in the bfd's
objalloc heap. So it _should_ be freed when bfd_close is called.
I don't understand why I'm not seeing it freed.
[I've wrapped malloc/free to watch for leaks.]
Sorry for the bother.