summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2007-07-26 11:13:59 +0000
committerAlan Modra <amodra@bigpond.net.au>2007-07-26 11:13:59 +0000
commit4cf1ab29a063dec767e1e19cc5bc255c2c469e76 (patch)
treed7176309eda9913cdd7f0b7c1768fee3af67dbdf /bfd
parent2775f262f8da03a164efb52574f83abdc046167f (diff)
downloadgdb-4cf1ab29a063dec767e1e19cc5bc255c2c469e76.tar.gz
* srec.c (srec_canonicalize_symtab): Don't alloc when symcount
is zero. Correct return value on error. * mmo.c (mmo_canonicalize_symtab): Likewise. * binary.c (binary_canonicalize_symtab) Correct return on error.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/binary.c2
-rw-r--r--bfd/mmo.c6
-rw-r--r--bfd/srec.c6
4 files changed, 14 insertions, 7 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 53bfe0d52b2..9bef708ab16 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2007-07-26 Alan Modra <amodra@bigpond.net.au>
+
+ * srec.c (srec_canonicalize_symtab): Don't alloc when symcount
+ is zero. Correct return value on error.
+ * mmo.c (mmo_canonicalize_symtab): Likewise.
+ * binary.c (binary_canonicalize_symtab) Correct return on error.
+
2007-07-26 Thiemo Seufer <ths@mips.com>
* bfd.c (_bfd_set_gp_value): Use abort instead of BFD_FAIL.
diff --git a/bfd/binary.c b/bfd/binary.c
index 38d0cc3fd4e..c4aec2ba615 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -169,7 +169,7 @@ binary_canonicalize_symtab (bfd *abfd, asymbol **alocation)
syms = bfd_alloc (abfd, amt);
if (syms == NULL)
- return 0;
+ return -1;
/* Start symbol. */
syms[0].the_bfd = abfd;
diff --git a/bfd/mmo.c b/bfd/mmo.c
index 0d3e9633e73..c0e8082826f 100644
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -2097,7 +2097,7 @@ mmo_canonicalize_symtab (bfd *abfd, asymbol **alocation)
unsigned int i;
csymbols = abfd->tdata.mmo_data->csymbols;
- if (csymbols == NULL)
+ if (csymbols == NULL && symcount != 0)
{
asymbol *c;
struct mmo_symbol *s;
@@ -2119,8 +2119,8 @@ mmo_canonicalize_symtab (bfd *abfd, asymbol **alocation)
mmo_sort_mmo_symbols);
csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol));
- if (csymbols == NULL && symcount != 0)
- return FALSE;
+ if (csymbols == NULL)
+ return -1;
abfd->tdata.mmo_data->csymbols = csymbols;
for (msp = (struct mmo_symbol **) alocation, c = csymbols;
diff --git a/bfd/srec.c b/bfd/srec.c
index cd61cd2dc35..a5f588c231e 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -1125,14 +1125,14 @@ srec_canonicalize_symtab (bfd *abfd, asymbol **alocation)
unsigned int i;
csymbols = abfd->tdata.srec_data->csymbols;
- if (csymbols == NULL)
+ if (csymbols == NULL && symcount != 0)
{
asymbol *c;
struct srec_symbol *s;
csymbols = bfd_alloc (abfd, symcount * sizeof (asymbol));
- if (csymbols == NULL && symcount != 0)
- return 0;
+ if (csymbols == NULL)
+ return -1;
abfd->tdata.srec_data->csymbols = csymbols;
for (s = abfd->tdata.srec_data->symbols, c = csymbols;