aboutsummaryrefslogtreecommitdiff
path: root/gdb/objfiles.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-08-02 11:57:20 -0600
committerTom Tromey <tom@tromey.com>2022-08-03 13:26:58 -0600
commit075e4d6d95681bfbf53e849c2802a75d1d4cbdca (patch)
tree603d88f26edb4f995a0f4820b0cd7c8bc46c76e3 /gdb/objfiles.c
parent98badbfdc222d1d7f346046f23a64522b88d22a0 (diff)
downloadgdb-075e4d6d95681bfbf53e849c2802a75d1d4cbdca.zip
gdb-075e4d6d95681bfbf53e849c2802a75d1d4cbdca.tar.gz
gdb-075e4d6d95681bfbf53e849c2802a75d1d4cbdca.tar.bz2
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.
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r--gdb/objfiles.c7
1 files changed, 0 insertions, 7 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 3db9135a6..c92da75 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -324,10 +324,6 @@ objfile::objfile (gdb_bfd_ref_ptr bfd_, const char *name, objfile_flags flags_)
{
const char *expanded_name;
- /* We could use obstack_specify_allocation here instead, but
- gdb_obstack.h specifies the alloc/dealloc functions. */
- obstack_init (&objfile_obstack);
-
std::string name_holder;
if (name == NULL)
{
@@ -583,9 +579,6 @@ objfile::~objfile ()
clear_current_source_symtab_and_line ();
}
- /* Free the obstacks for non-reusable objfiles. */
- obstack_free (&objfile_obstack, 0);
-
/* Rebuild section map next time we need it. */
get_objfile_pspace_data (pspace)->section_map_dirty = 1;
}