This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] Fix reloc initialization in gas/write.c
- From: Thiemo Seufer <ica2_ts at csv dot ica dot uni-stuttgart dot de>
- To: binutils at sources dot redhat dot com
- Date: Wed, 11 Jun 2003 02:14:59 +0200
- Subject: [PATCH] Fix reloc initialization in gas/write.c
Hello All,
this initializes in the RELOC_EXPANSION_POSSIBLE case the contents
of 'relocs' with zeros, and uses xcalloc instead of xmalloc/memset.
Thiemo
2003-06-11 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
/gas/ChangeLog
* write.c (write_relocs): Use xcalloc. Fix relocs initialization
in the RELOC_EXPANSION_POSSIBLE case.
diff -urpNX /bigdisk/src/gcc-exclude source-orig/gas/write.c source/gas/write.c
--- source-orig/gas/write.c Wed Apr 23 19:15:03 2003
+++ source/gas/write.c Tue Jun 10 19:13:35 2003
@@ -938,8 +938,7 @@ write_relocs (abfd, sec, xxx)
#ifndef RELOC_EXPANSION_POSSIBLE
/* Set up reloc information as well. */
- relocs = (arelent **) xmalloc (n * sizeof (arelent *));
- memset ((char *) relocs, 0, n * sizeof (arelent *));
+ relocs = (arelent **) xcalloc (n, sizeof (arelent *));
i = 0;
for (fixp = seginfo->fix_root; fixp != (fixS *) NULL; fixp = fixp->fx_next)
@@ -1011,7 +1010,7 @@ write_relocs (abfd, sec, xxx)
#else
n = n * MAX_RELOC_EXPANSION;
/* Set up reloc information as well. */
- relocs = (arelent **) xmalloc (n * sizeof (arelent *));
+ relocs = (arelent **) xcalloc (n, sizeof (arelent *));
i = 0;
for (fixp = seginfo->fix_root; fixp != (fixS *) NULL; fixp = fixp->fx_next)