mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 01:07:52 +00:00
Use gdb_bfd_ref_ptr in objfile
This changes struct objfile to use a gdb_bfd_ref_ptr. In addition to removing some manual memory management, this fixes a use-after-free that was introduced by the registry rewrite series. The issue there was that, in some cases, registry shutdown could refer to memory that had already been freed. This help fix the bug by delaying the destruction of the BFD reference (and thus the per-bfd object) until after the registry has been shut down.
This commit is contained in:
@@ -643,7 +643,7 @@ compile_object_load (const compile_file_names &file_names,
|
||||
|
||||
/* SYMFILE_VERBOSE is not passed even if FROM_TTY, user is not interested in
|
||||
"Reading symbols from ..." message for automatically generated file. */
|
||||
objfile_up objfile_holder (symbol_file_add_from_bfd (abfd.get (),
|
||||
objfile_up objfile_holder (symbol_file_add_from_bfd (abfd,
|
||||
filename.get (),
|
||||
0, NULL, 0, NULL));
|
||||
objfile = objfile_holder.get ();
|
||||
|
||||
Reference in New Issue
Block a user