aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorDavid MacKenzie <djm@cygnus>1994-02-12 00:59:26 +0000
committerDavid MacKenzie <djm@cygnus>1994-02-12 00:59:26 +0000
commita15691a56e059d4c715353c3dece0fed51162363 (patch)
tree01e832c30f34e9cc599ff734d8e9039e682e6f4f /bfd
parent9783e04a6438e7d81c48d202b2c1bfab315a91f8 (diff)
downloadgdb-a15691a56e059d4c715353c3dece0fed51162363.zip
gdb-a15691a56e059d4c715353c3dece0fed51162363.tar.gz
gdb-a15691a56e059d4c715353c3dece0fed51162363.tar.bz2
* archive.c (normalize) [VMS]: Call malloc, not bfd_xmalloc.
(bfd_construct_extended_name_table): Check result of normalize.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/archive.c24
2 files changed, 26 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 00d698c..14c77fe 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+Fri Feb 11 16:56:50 1994 David J. Mackenzie (djm@thepub.cygnus.com)
+
+ * archive.c (normalize) [VMS]: Call malloc, not bfd_xmalloc.
+ (bfd_construct_extended_name_table): Check result of normalize.
+
Tue Feb 8 08:57:31 1994 David J. Mackenzie (djm@thepub.cygnus.com)
Make all callers of malloc or realloc (including via obstacks)
diff --git a/bfd/archive.c b/bfd/archive.c
index 852124a..b96a2b8 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -1121,7 +1121,10 @@ normalize (file)
}
- copy = bfd_xmalloc (last - first + 1);
+ copy = malloc (last - first + 1);
+ if (!copy)
+ return copy;
+
memcpy (copy, first, last - first);
copy[last - first] = 0;
@@ -1167,7 +1170,15 @@ bfd_construct_extended_name_table (abfd, tabloc, tablen)
/* Figure out how long the table should be */
for (current = abfd->archive_head; current != NULL; current = current->next)
{
- unsigned int thislen = strlen (normalize (current->filename));
+ CONST char *normal = normalize (current->filename);
+ unsigned int thislen;
+
+ if (!normal)
+ {
+ bfd_error = no_memory;
+ return false;
+ }
+ thislen = strlen (normal);
if (thislen > maxname)
total_namelen += thislen + 1; /* leave room for \n */
}
@@ -1189,7 +1200,14 @@ bfd_construct_extended_name_table (abfd, tabloc, tablen)
current->next)
{
CONST char *normal = normalize (current->filename);
- unsigned int thislen = strlen (normal);
+ unsigned int thislen;
+
+ if (!normal)
+ {
+ bfd_error = no_memory;
+ return false;
+ }
+ thislen = strlen (normal);
if (thislen > maxname)
{
/* Works for now; may need to be re-engineered if we