[PATCH v1 2/7] Object Attributes v2: clean up attributes data when freeing BFDs
Jan Beulich
jbeulich@suse.com
Thu Feb 5 10:41:07 GMT 2026
More information about the Binutils mailing list
Thu Feb 5 10:41:07 GMT 2026
- Previous message (by thread): [PATCH v1 2/7] Object Attributes v2: clean up attributes data when freeing BFDs
- Next message (by thread): [PATCH v1 3/7] bfd: fix memory leak when assigning the merge result of OAv2 string attributes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 03.02.2026 11:00, Matthieu Longo wrote: > Once attributes merge is complete, object attributes from input files > are no longer needed and can be safely released. The same applies to > object attributes associated to the output object. Ideally, a single > clean-up mechanism should handle both inputs and output cases. GNU ld > already provides such a mechanism via _bfd_elf_free_cached_info(). > > The previous patch series that introduced support for Object Attributes > v2 did not free any OAv2 data, resulting in leaks of all OAv2-related > resources. > > This patch adds a new helper, _bfd_elf_cleanup_object_attributes, to > the OAv2 API to deallocate all OAv2 resources associated with a BFD. > The helper is invoked from _bfd_elf_free_cached_info(). > > The patch also fixes a logical error after the attributes merge, where > object attributes were copied from the accumulator into output_bfd. A > simple pointer copy is insufficient because ownership of the wrapper > must be fully swapped between the two BFDs to ensure resources are > deallocated correctly. > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33858 > Co-authored-by: Alan Modra <amodra@gmail.com> > --- > bfd/elf-attrs.c | 19 +++++++++++++++---- > bfd/elf-bfd.h | 2 ++ > bfd/elf.c | 1 + > 3 files changed, 18 insertions(+), 4 deletions(-) Okay. Jan
- Previous message (by thread): [PATCH v1 2/7] Object Attributes v2: clean up attributes data when freeing BFDs
- Next message (by thread): [PATCH v1 3/7] bfd: fix memory leak when assigning the merge result of OAv2 string attributes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list