This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

PATCH: Call bfd_zalloc to allocate elf_segment_map


http://sourceware.org/ml/binutils/2006-12/msg00165.html

adds a new entry to elf_segment_map. But bfd_record_phdr doesn't
initialize it. I am checking this patch to fix it.


H.J.
---
2006-12-31  H.J. Lu  <hongjiu.lu@intel.com>

	* bfd.c (bfd_record_phdr): Call bfd_zalloc instead of bfd_alloc
	to allocate elf_segment_map.

--- bfd/bfd.c.foo	2006-10-29 23:41:17.000000000 -0800
+++ bfd/bfd.c	2006-12-31 09:20:05.000000000 -0800
@@ -1352,11 +1352,10 @@ bfd_record_phdr (bfd *abfd,
 
   amt = sizeof (struct elf_segment_map);
   amt += ((bfd_size_type) count - 1) * sizeof (asection *);
-  m = bfd_alloc (abfd, amt);
+  m = bfd_zalloc (abfd, amt);
   if (m == NULL)
     return FALSE;
 
-  m->next = NULL;
   m->p_type = type;
   m->p_flags = flags;
   m->p_paddr = at;
@@ -1365,8 +1364,6 @@ bfd_record_phdr (bfd *abfd,
   m->includes_filehdr = includes_filehdr;
   m->includes_phdrs = includes_phdrs;
   m->count = count;
-  m->p_align_valid = FALSE;
-  m->p_align = 0;
   if (count > 0)
     memcpy (m->sections, secs, count * sizeof (asection *));
 


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