aboutsummaryrefslogtreecommitdiff
path: root/gdb/cp-namespace.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/cp-namespace.c')
-rw-r--r--gdb/cp-namespace.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index d2d8f2e..a7a387b 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -714,7 +714,6 @@ check_one_possible_namespace_symbol (const char *name, int len,
if (sym == NULL)
{
struct type *type;
- name_copy = obsavestring (name, len, &objfile->objfile_obstack);
type = init_type (TYPE_CODE_NAMESPACE, 0, 0, name_copy, objfile);
@@ -723,7 +722,9 @@ check_one_possible_namespace_symbol (const char *name, int len,
sym = obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
SYMBOL_LANGUAGE (sym) = language_cplus;
- SYMBOL_SET_NAMES (sym, name_copy, len, objfile);
+ /* Note that init_type copied the name to the objfile's
+ obstack. */
+ SYMBOL_SET_NAMES (sym, TYPE_NAME (type), len, 0, objfile);
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
SYMBOL_TYPE (sym) = type;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;