From 2ef5453be5e06566f60edcba7700503259c29b47 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 19 Feb 2020 11:06:33 -0700 Subject: [PATCH] Use obstack_strdup in ada-lang.c I happened across a spot that was still using obstack_alloc and strcpy, rather than obstack_strdup. This patch makes the obvious fix. gdb/ChangeLog 2020-02-19 Tom Tromey * ada-lang.c (cache_symbol): Use obstack_strdup. --- gdb/ChangeLog | 4 ++++ gdb/ada-lang.c | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4a2f81323a7..78253116170 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2020-02-19 Tom Tromey + + * ada-lang.c (cache_symbol): Use obstack_strdup. + 2020-02-19 Andrew Burgess * configure: Regenerate. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index c5b5fdf169f..316eaf50b9a 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4710,7 +4710,6 @@ cache_symbol (const char *name, domain_enum domain, struct symbol *sym, struct ada_symbol_cache *sym_cache = ada_get_symbol_cache (current_program_space); int h; - char *copy; struct cache_entry *e; /* Symbols for builtin types don't have a block. @@ -4733,9 +4732,7 @@ cache_symbol (const char *name, domain_enum domain, struct symbol *sym, e = XOBNEW (&sym_cache->cache_space, cache_entry); e->next = sym_cache->root[h]; sym_cache->root[h] = e; - e->name = copy - = (char *) obstack_alloc (&sym_cache->cache_space, strlen (name) + 1); - strcpy (copy, name); + e->name = obstack_strdup (&sym_cache->cache_space, name); e->sym = sym; e->domain = domain; e->block = block; -- 2.30.2