Skip to content

output/outelf.c: free the section name and struct on cleanup - #265

Open
succubus-uwu wants to merge 1 commit into
netwide-assembler:masterfrom
succubus-uwu:master
Open

output/outelf.c: free the section name and struct on cleanup#265
succubus-uwu wants to merge 1 commit into
netwide-assembler:masterfrom
succubus-uwu:master

Conversation

@succubus-uwu

@succubus-uwu succubus-uwu commented Jul 20, 2026

Copy link
Copy Markdown

elf_cleanup() frees each section's data, relocations and reloc list,
then frees the sects pointer array itself - but never the section
structs it points to, nor their strdup'd names. Every section leaks
on every ELF run. This is the ELF counterpart of the outobj.c
"free the section name on cleanup" fix.

Confirmed with leaks (macOS): a multi-section elf64 assemble went
from "11 leaks for 864 total leaked bytes" to zero. Output is
byte-for-byte identical before and after across elf32/elf64/elfx32
including -F dwarf and -F stabs.


Sorry, I forgot the sign-off. Please add:

Signed-off-by: Anton Kochergin succubus.vwv@gmail.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant