* libbfd.c (bfd_malloc, bfd_realloc): New functions.
[deliverable/binutils-gdb.git] / bfd / elf.c
index 424372ce2c52365a1d17f641f3c47bca2a25125e..87eaa943595d4268f95ea39eb0455abf6167c371 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1158,12 +1158,9 @@ assign_section_numbers (abfd)
              char *alc;
 
              len = strlen (sec->name);
-             alc = (char *) malloc (len - 2);
+             alc = (char *) bfd_malloc (len - 2);
              if (alc == NULL)
-               {
-                 bfd_set_error (bfd_error_no_memory);
-                 return false;
-               }
+               return false;
              strncpy (alc, sec->name, len - 3);
              alc[len - 3] = '\0';
              s = bfd_get_section_by_name (abfd, alc);
@@ -1548,13 +1545,10 @@ map_sections_to_segments (abfd)
 
   /* Select the allocated sections, and sort them.  */
 
-  sections = (asection **) malloc (bfd_count_sections (abfd)
-                                  * sizeof (asection *));
+  sections = (asection **) bfd_malloc (bfd_count_sections (abfd)
+                                      * sizeof (asection *));
   if (sections == NULL)
-    {
-      bfd_set_error (bfd_error_no_memory);
-      goto error_return;
-    }
+    goto error_return;
 
   i = 0;
   for (s = abfd->sections; s != NULL; s = s->next)
This page took 0.023931 seconds and 4 git commands to generate.