aboutsummaryrefslogtreecommitdiff
path: root/gdb/demangle.c
diff options
context:
space:
mode:
authorDaniel Berlin <dberlin@dberlin.org>2001-04-16 14:36:16 +0000
committerDaniel Berlin <dberlin@dberlin.org>2001-04-16 14:36:16 +0000
commit9e0c176c3ba84547dc6c5dbe3edd0796fdb8a44f (patch)
tree81dfe89003a240ca344311ef7dc28b9fb69f93eb /gdb/demangle.c
parenta5dd804ef976bf2b4cb8f83df19c6e5dc7245a3c (diff)
downloadfsf-binutils-gdb-9e0c176c3ba84547dc6c5dbe3edd0796fdb8a44f.zip
fsf-binutils-gdb-9e0c176c3ba84547dc6c5dbe3edd0796fdb8a44f.tar.gz
fsf-binutils-gdb-9e0c176c3ba84547dc6c5dbe3edd0796fdb8a44f.tar.bz2
2001-04-16 Daniel Berlin <dan@cgsoftware.com>
* demangle.c (_initialize_demangler): Use xcalloc on the demangling_style_names, and make it a null terminated array of names, to avoid a crash.
Diffstat (limited to 'gdb/demangle.c')
-rw-r--r--gdb/demangle.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/demangle.c b/gdb/demangle.c
index 4b5bc9b..0104d8f 100644
--- a/gdb/demangle.c
+++ b/gdb/demangle.c
@@ -186,7 +186,7 @@ _initialize_demangler (void)
libiberty_demanglers[ndems].demangling_style != unknown_demangling;
ndems++)
;
- demangling_style_names = xmalloc (ndems * sizeof (char *));
+ demangling_style_names = xcalloc (ndems + 1, sizeof (char *));
for (i = 0;
libiberty_demanglers[i].demangling_style != unknown_demangling;
i++)