This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: Another BFD corefile issue
- To: msnyder at cygnus dot com
- Subject: Re: Another BFD corefile issue
- From: Ian Lance Taylor <ian at zembu dot com>
- Date: 7 Apr 2000 08:16:19 -0700
- CC: gdb-patches at sourceware dot cygnus dot com
- References: <000b01bfa03d$d541c610$22295dc6@snyder.cygnus.com>
From: "Michael Snyder" <msnyder@cygnus.com>
Date: Thu, 6 Apr 2000 20:03:20 -0700
Also in elfcore.h, elf64_core_file_p may be called more than once from
bfd_check_format_matches. If an earlier call matches, and a later call
ALMOST matches, it may clobber the earlier allocated pointer for
elf_obj_data. I believe that the elf_zalloc call for elf_obj_data is done
too early, and I would like to move it down to just before it is actually
needed -- thus reducing the chance of it being called on a near-match.
The circumstance where this bites us is when elf64-sparc target comes
before elf64-big.
2000-04-06 Michael Snyder <msnyder@seadog.cygnus.com>
* elfcore.h (elf_core_file_p): delay allocating elf_obj_data
until it is needed, reducing the chances of memory leaks or
good data being clobbered unnecessarily.
There is no serious memory leak here, as anything allocated using
bfd_zalloc will be freed when the BFD is closed.
However, if the format does not match, the function should bfd_release
any tdata it has allocated. See elf_object_p in elfcode.h.
Ian