This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 3/5] remove deleted BFDs from the archive cache
On Fri, Aug 17, 2012 at 10:09:33AM -0600, Tom Tromey wrote:
> I found a few oddities in BFD while working on this patch:
Only a few? :)
> --- a/bfd/archive.c
> +++ b/bfd/archive.c
> @@ -517,7 +517,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
> parsed_size -= namelen;
> extra_size = namelen;
>
> - allocptr = (char *) bfd_zalloc (abfd, allocsize);
> + allocptr = (char *) bfd_zmalloc (allocsize);
> if (allocptr == NULL)
> return NULL;
> filename = (allocptr
There's a "return NULL" a few line down from here where you should
free allocptr.
> @@ -655,13 +655,13 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
> if (ext_arch == NULL
> || ! bfd_check_format (ext_arch, bfd_archive))
> {
> - bfd_release (archive, new_areldata);
> + free (new_areldata);
> return NULL;
> }
Ditto for a few lines before here. Other than that, this looks like a
nice cleanup. Thanks!
--
Alan Modra
Australia Development Lab, IBM