From: Simon Marchi Date: Thu, 8 Jan 2026 19:33:23 +0000 (-0500) Subject: gdb/xcoffread: allocate symbol table using vector in scan_xcoff_symtab X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b35f0915ee4a3ebb8c239db004a08719700799b7;p=thirdparty%2Fbinutils-gdb.git gdb/xcoffread: allocate symbol table using vector in scan_xcoff_symtab The symbol table content is only needed for the duration of scan_xcoff_symtab, so it's not necessary to allocate it on the objfile obstack. Switch to using a vector that is freed at the end of the function. Change-Id: Ib5acdea460969300a92816a3e71b7d82c80faebf Approved-By: Tom Tromey --- diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index f84b99f40af..da431a150f8 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -165,14 +165,14 @@ scan_xcoff_symtab (struct objfile *objfile) unsigned int num_symbols = bfd_get_symcount (abfd); size_t size = coff_data (abfd)->local_symesz * num_symbols; - char *symtbl = (char *) obstack_alloc (&objfile->objfile_obstack, size); + gdb::char_vector symtbl (size); /* Read in symbol table. */ - if (int ret = bfd_read (symtbl, size, abfd); + if (int ret = bfd_read (symtbl.data (), size, abfd); ret != size) error (_("reading symbol table: %s"), bfd_errmsg (bfd_get_error ())); - char *sraw_symbol = symtbl; + char *sraw_symbol = symtbl.data (); ssymnum = 0; while (ssymnum < num_symbols) {