]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/xcoffread: allocate symbol table using vector in scan_xcoff_symtab
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 8 Jan 2026 19:33:23 +0000 (14:33 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Fri, 9 Jan 2026 02:05:49 +0000 (21:05 -0500)
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 <tom@tromey.com>
gdb/xcoffread.c

index f84b99f40af3985f7f952c0f2ca71ad8d47b1997..da431a150f8ec560ef77fb6c9630b0e6b98c095e 100644 (file)
@@ -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)
     {