PR24955, libbfd terminating program on out of memory (part2)
[deliverable/binutils-gdb.git] / bfd / elflink.c
index 395d96d6cfb5ed6ccdcef1522a72b3d55e6cb885..d0f70cb6f58007aee7d5755888f546df82a21838 100644 (file)
@@ -11649,7 +11649,10 @@ elf_output_implib (bfd *abfd, struct bfd_link_info *info)
     return FALSE;
 
   /* Read in the symbol table.  */
-  sympp = (asymbol **) xmalloc (symsize);
+  sympp = (asymbol **) bfd_malloc (symsize);
+  if (sympp == NULL)
+    return FALSE;
+
   symcount = bfd_canonicalize_symtab (abfd, sympp);
   if (symcount < 0)
     goto free_sym_buf;
@@ -11677,6 +11680,9 @@ elf_output_implib (bfd *abfd, struct bfd_link_info *info)
   /* Make symbols absolute.  */
   osymbuf = (elf_symbol_type *) bfd_alloc2 (implib_bfd, symcount,
                                            sizeof (*osymbuf));
+  if (osymbuf == NULL)
+    goto free_sym_buf;
+
   for (src_count = 0; src_count < symcount; src_count++)
     {
       memcpy (&osymbuf[src_count], (elf_symbol_type *) sympp[src_count],
This page took 0.028191 seconds and 4 git commands to generate.