Fixes incorrect `sframe_encoder_free` calls.
Corrected calls to `sframe_encoder_free` to prevent double frees.
This patch fixes incorrect calls to sframe_encoder_free in _bfd_elf_write_section_sframe, _bfd_s390_elf_write_sframe_plt, and _bfd_x86_elf_write_sframe_plt. Passing the address of a local variable instead of the actual context address to sframe_encoder_free can lead to double frees. The patch ensures that the correct context address is passed, preventing potential memory corruption.
In Details
This commit addresses an issue in the Binary File Descriptor (BFD) library related to sframe encoding. Specifically, the sframe_encoder_free function was being called with the address of a local variable instead of the actual context address. This could lead to double frees and memory corruption. The patch corrects these calls in bfd/elf-sframe.c, bfd/elf64-s390.c, and bfd/elfxx-x86.c.
For Context
The Binary File Descriptor (BFD) library is a part of binutils that allows programs to work with different object file formats in a uniform way. This commit fixes a bug related to memory management in the sframe encoder. The sframe_encoder_free function was being called incorrectly, which could lead to the same memory being freed twice, causing crashes or unpredictable behavior. The patch corrects how this function is called, preventing these issues.