[binutils-gdb/binutils-2_46-branch] Correct calls to sframe_decoder_free
Alan Modra
amodra@sourceware.org
Wed May 27 03:35:36 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=09a510d7e3f68455a3ecc71ee7f7e692315938b3
commit 09a510d7e3f68455a3ecc71ee7f7e692315938b3
Author: Alan Modra <amodra@gmail.com>
Date: Wed Feb 11 15:30:40 2026 +1030
Correct calls to sframe_decoder_free
Correct calls to sframe_decoder_free so that sfd_info->stf_ctx is
cleared. If sfd_info->stf_ctx isn't cleared we can get double frees.
* elf-sframe.c (sframe_decode): Do not pass local var sfd_ctx
address to sframe_decoder_free, pass the actual context address.
(_bfd_elf_merge_section_sframe): Likewise.
(bug-fix cherry-pick from 3949fb481a6739dc1f4dc5fad09d7646c90af3d2
without the free on bfd_close.)
Diff:
---
bfd/elf-sframe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bfd/elf-sframe.c b/bfd/elf-sframe.c
index e84b757ca37..c28f1236a2f 100644
--- a/bfd/elf-sframe.c
+++ b/bfd/elf-sframe.c
@@ -282,7 +282,7 @@ _bfd_elf_parse_sframe (bfd *abfd,
if (!sframe_decoder_init_func_bfdinfo (abfd, sec, sfd_info, cookie))
{
- sframe_decoder_free (&sfd_ctx);
+ sframe_decoder_free (&sfd_info->sfd_ctx);
goto fail_no_free;
}
@@ -601,7 +601,7 @@ _bfd_elf_merge_section_sframe (bfd *abfd,
sfd_info->sfd_state = SFRAME_SEC_MERGED;
/* Free the SFrame decoder context. */
- sframe_decoder_free (&sfd_ctx);
+ sframe_decoder_free (&sfd_info->sfd_ctx);
return true;
}
More information about the Binutils-cvs
mailing list