Use auto_obstack in objfile

This changes objfile to use an auto_obstack.  This helps prevent
use-after-free bugs, because it ensures that anything allocated on the
objfile obstack will live past the point at which the registry object
is destroyed.
This commit is contained in:
Tom Tromey 2022-08-02 11:57:20 -06:00
parent 98badbfdc2
commit 075e4d6d95
2 changed files with 1 additions and 8 deletions

View file

@ -666,7 +666,7 @@ public:
/* Obstack to hold objects that should be freed when we load a new symbol
table from this object file. */
struct obstack objfile_obstack {};
auto_obstack objfile_obstack;
/* Structure which keeps track of functions that manipulate objfile's
of the same type as this objfile. I.e. the function to read partial