diff options
author | Alan Modra <amodra@gmail.com> | 2023-12-15 12:24:56 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-12-15 12:56:45 +1030 |
commit | 4ace84a15ca943f52e590c264d82dfba350482e3 (patch) | |
tree | f852ce970fbabb72857fef066c82d9b8e1c2dfeb /bfd/opncls.c | |
parent | e838a672aa787fb593d4819fa4836cad7db49e66 (diff) | |
download | gdb-4ace84a15ca943f52e590c264d82dfba350482e3.zip gdb-4ace84a15ca943f52e590c264d82dfba350482e3.tar.gz gdb-4ace84a15ca943f52e590c264d82dfba350482e3.tar.bz2 |
PR31145, potential memory leak in binutils/ld
PR 31145
* bfd.c (BFD_IN_MEMORY): Mention that bim is malloc'd.
* format.c (io_reinit): Free BFD_IN_MEMORY iostream.
* opncls.c (_bfd_delete_bfd): Likewise.
(bfd_make_readable): Delete unnecessary code.
* bfd-in2.h: Regenerate.
Diffstat (limited to 'bfd/opncls.c')
-rw-r--r-- | bfd/opncls.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/bfd/opncls.c b/bfd/opncls.c index 5a77562..e7b3959 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -176,6 +176,8 @@ _bfd_delete_bfd (bfd *abfd) else free ((char *) bfd_get_filename (abfd)); + if ((abfd->flags & BFD_IN_MEMORY) != 0) + free (abfd->iostream); free (abfd->arelt_data); free (abfd); } @@ -1064,7 +1066,6 @@ bfd_make_readable (bfd *abfd) abfd->section_count = 0; abfd->usrdata = NULL; abfd->cacheable = false; - abfd->flags |= BFD_IN_MEMORY; abfd->mtime_set = false; abfd->target_defaulted = true; |