bfd_alloc can return NULL on out-of-memory so code needs to check the
return value and print an error. That check was missing in write.c.
notes_alloc won't return NULL, instead the underlying obstack_alloc
prints an OOM message and the process exits. This is more convenient,
and when the bfd_alloc memory is attached to the gas output bfd it is
released only slightly before the notes obstack.
* config/obj-macho.c (obj_mach_o_set_indirect_symbols): Use
notes_calloc rather than bfd_zalloc.
* write.c (set_symtab): Use notes_alloc.
if (nactual < bfd_get_symcount (abfd))
nactual = bfd_get_symcount (abfd);
- ms->indirect_syms =
- bfd_zalloc (abfd,
- nactual * sizeof (bfd_mach_o_asymbol *));
-
- if (ms->indirect_syms == NULL)
- as_fatal (_("internal error: failed to allocate %d indirect"
- "symbol pointers"), nactual);
+ ms->indirect_syms = notes_calloc (nactual,
+ sizeof (*ms->indirect_syms));
for (isym = list, n = 0; isym != NULL; isym = isym->next, n++)
{
if (nsyms)
{
int i;
- bfd_size_type amt = (bfd_size_type) nsyms * sizeof (asymbol *);
- asympp = (asymbol **) bfd_alloc (stdoutput, amt);
+ asympp = notes_alloc (nsyms * sizeof (asymbol *));
symp = symbol_rootP;
for (i = 0; i < nsyms; symp = symbol_next (symp))
if (!symbol_removed_p (symp)