aboutsummaryrefslogtreecommitdiff
path: root/gdb/demangle.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/demangle.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/demangle.c')
-rw-r--r--gdb/demangle.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gdb/demangle.c b/gdb/demangle.c
index 5bcf437..eecd3d3 100644
--- a/gdb/demangle.c
+++ b/gdb/demangle.c
@@ -129,7 +129,8 @@ set_demangling_command (ignore, from_tty, c)
{
free (current_demangling_style_string);
current_demangling_style_string =
- strdup (dem -> demangling_style_name);
+ savestring (dem -> demangling_style_name,
+ strlen (dem -> demangling_style_name));
}
}
if (current_demangling_style == unknown_demangling)
@@ -139,7 +140,8 @@ set_demangling_command (ignore, from_tty, c)
one as the default. */
current_demangling_style = demanglers[0].demangling_style;
current_demangling_style_string =
- strdup (demanglers[0].demangling_style_name);
+ savestring (demanglers[0].demangling_style_name,
+ strlen (demanglers[0].demangling_style_name));
warning ("`%s' style demangling chosen as the default.\n",
current_demangling_style_string);
}
@@ -156,7 +158,7 @@ set_demangling_style (style)
{
free (current_demangling_style_string);
}
- current_demangling_style_string = strdup (style);
+ current_demangling_style_string = savestring (style, strlen (style));
set_demangling_command ((char *) NULL, 0);
}