aboutsummaryrefslogtreecommitdiff
path: root/gdb/buildsym.c
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1994-03-26 04:26:26 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1994-03-26 04:26:26 +0000
commitbb6247c6b2232cbe9b8b3fbe8fc202a4c502ecea (patch)
tree881c65b8922d4280a12fc35ab5767e997f155e40 /gdb/buildsym.c
parent493424b108c2461cab7192f65a8193c3ad1280dc (diff)
downloadgdb-bb6247c6b2232cbe9b8b3fbe8fc202a4c502ecea.zip
gdb-bb6247c6b2232cbe9b8b3fbe8fc202a4c502ecea.tar.gz
gdb-bb6247c6b2232cbe9b8b3fbe8fc202a4c502ecea.tar.bz2
* buildsym.c (start_subfile, patch_subfile_names), demangle.c
(set_demangling_style, set_demangling_command): Use savestring not strdup. We were not dealing properly with a NULL return from strdup, and were not declaring strdup (the system header may or may not have it).
Diffstat (limited to 'gdb/buildsym.c')
-rw-r--r--gdb/buildsym.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 0fe22d1..e4dcbdd 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -405,8 +405,9 @@ start_subfile (name, dirname)
current_subfile = subfile;
/* Save its name and compilation directory name */
- subfile->name = (name == NULL)? NULL : strdup (name);
- subfile->dirname = (dirname == NULL) ? NULL : strdup (dirname);
+ subfile->name = (name == NULL) ? NULL : savestring (name, strlen (name));
+ subfile->dirname =
+ (dirname == NULL) ? NULL : savestring (dirname, strlen (dirname));
/* Initialize line-number recording for this subfile. */
subfile->line_vector = NULL;
@@ -479,7 +480,7 @@ patch_subfile_names (subfile, name)
&& subfile->name[strlen(subfile->name)-1] == '/')
{
subfile->dirname = subfile->name;
- subfile->name = strdup (name);
+ subfile->name = savestring (name, strlen (name));
/* Default the source language to whatever can be deduced from
the filename. If nothing can be deduced (such as for a C/C++