This is the mail archive of the binutils@sources.redhat.com 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]

Re: elf32-hppa shared lib support part 4


On 18 Sep 2000, Ian Lance Taylor wrote:

>    +  sname = bfd_malloc (len + 7);
>    +  strcpy (sname, template);
> 
> bfd_malloc is not xmalloc.  You need to check the return value.  I've

Thanks Ian.  I'll commit the following to fix it then.

--- bfd/section.c~	Thu Sep  7 22:47:39 2000
+++ bfd/section.c	Tue Sep 19 09:44:28 2000
@@ -660,6 +660,10 @@ DESCRIPTION
 	pointed to by @var{count} will be incremented in this case.
 */
 
+#ifndef EXIT_FAILURE
+#define EXIT_FAILURE 1
+#endif
+
 char *
 bfd_get_unique_section_name (abfd, templat, count)
      bfd *abfd;
@@ -672,6 +676,11 @@ bfd_get_unique_section_name (abfd, templ
 
   len = strlen (templat);
   sname = bfd_malloc (len + 8);
+  if (sname == NULL)
+    {
+      bfd_perror (bfd_get_error ());
+      xexit (EXIT_FAILURE);
+    }
   strcpy (sname, templat);
   num = 1;
   if (count != NULL)

-- 
Linuxcare.  Support for the Revolution.



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