diff options
author | Tom Tromey <tom@tromey.com> | 2022-08-02 09:55:32 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-08-03 13:26:58 -0600 |
commit | 98badbfdc222d1d7f346046f23a64522b88d22a0 (patch) | |
tree | a57a95b75f64a0e318e0b1bd31dd6b246e4797d8 /gdb/coff-pe-read.c | |
parent | 4d44946794e68cf79cfba467fa414a958dba2185 (diff) | |
download | gdb-98badbfdc222d1d7f346046f23a64522b88d22a0.zip gdb-98badbfdc222d1d7f346046f23a64522b88d22a0.tar.gz gdb-98badbfdc222d1d7f346046f23a64522b88d22a0.tar.bz2 |
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.
Diffstat (limited to 'gdb/coff-pe-read.c')
-rw-r--r-- | gdb/coff-pe-read.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c index 72bd43b..2f3b808 100644 --- a/gdb/coff-pe-read.c +++ b/gdb/coff-pe-read.c @@ -300,7 +300,7 @@ void read_pe_exported_syms (minimal_symbol_reader &reader, struct objfile *objfile) { - bfd *dll = objfile->obfd; + bfd *dll = objfile->obfd.get (); unsigned long nbnormal, nbforward; unsigned long pe_header_offset, opthdr_ofs, num_entries, i; unsigned long export_opthdrrva, export_opthdrsize; @@ -312,7 +312,7 @@ read_pe_exported_syms (minimal_symbol_reader &reader, int is_pe64 = 0; int is_pe32 = 0; - char const *target = bfd_get_target (objfile->obfd); + char const *target = bfd_get_target (objfile->obfd.get ()); std::vector<struct read_pe_section_data> section_data (PE_SECTION_TABLE_SIZE); |