This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] check for null return from bfd_malloc


On Thu, Jul 05, 2007 at 04:56:01PM -0700, msnyder@sonic.net wrote:
> It seems that most returns from bfd_malloc are checked for null...

Yes, they should be..

> *************** elf_collect_hash_codes (struct elf_link_
> *** 4988,4993 ****
> --- 4988,4995 ----
>     if (p != NULL)
>       {
>         alc = bfd_malloc (p - name + 1);
> +       if (alc == NULL)
> + 	return FALSE;

But unfortunately, returning FALSE here does not flag an error.  All
it does is cut short the hash traversal.  If you would like to fix
this properly you'll need to pass an error status back to
bfd_elf_size_dynsym_hash_dynstr.  See elf_link_output_extsym for an
example of how this is done.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]