[patch] check for null return from bfd_malloc
Alan Modra
amodra@bigpond.net.au
Fri Jul 6 02:26:00 GMT 2007
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
More information about the Binutils
mailing list