[patch] BFD ieee.c fix

Nick Clifton nickc@redhat.com
Wed Oct 18 12:22:00 GMT 2000


Hi Guys,

: Alan Modra <alan@linuxcare.com.au> writes:
: > I recommend this patch _not_ be applied, nor any future patch mentioning
: > the word trivial associated with bfd_release!
: 
: Heh.  Based on your comment, and the semantics of bfd_release (of
: which I wasn't aware) i'm not convinced that there's really an error
: in that function at all.

Well hold on there, there may still be a memory leak.  In the function
we are looking at, the first instance of "goto got_wrong_format_error"
does not call bfd_release(), but the second one does.  (And the memory
being released was allocated at the start of the function, before the
first goto).  This implies that either the call to bfd_release by the
second goto is wrong, or that it is OK and the first goto also ought
to call bfd_release.

The only function call between the bfd_alloc that allocates the memory
that is the argument to the bfd_release and the first goto is a call
to bfd_read.  bfd_read does not allocate any memory, nor do any of the
functions that it calls, (I checked).  read_id does allocate memory,
but that is called after the first goto, not before it, so there is no
problem there.

Thus I actually think that that patch is OK.  I am not going to check
it in yet, in case there are any more comments, but if no has any more
objections then it will go in.

Cheers
	Nick




More information about the Binutils mailing list