This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: Patch to fix memory leak in bfd
- To: nickc@cygnus.com
- Subject: Re: Patch to fix memory leak in bfd
- From: Ian Lance Taylor <ian@zembu.com>
- Date: 2 Sep 1999 14:07:05 -0400
- CC: binutils@sourceware.cygnus.com
- References: <199909021759.SAA30310@pathia.cygnus.co.uk>
Date: Thu, 2 Sep 1999 18:59:42 +0100
From: Nick Clifton <nickc@cygnus.com>
I have just applied the following patch to fix a memory leak in
bfd.
Thanks. I wouldn't call that a memory leak--a memory leak is a case
where memory is allocated but never freed. What you fixed is a case
of memory corruption.
Incidentally, that code appears to have another, less serious, bug,
which is that if realloc or calloc fail, it should call bfd_set_error
(bfd_error_no_memory). Since it doesn't, a memory allocation failure
will not be reported back to the user correctly. Most code does this
by calling bfd_malloc or bfd_realloc, in libbfd.c, rather than malloc
or realloc.
Ian