FRIDAY, JULY 3, 2026
binutils/libctf
Fix double free in ctf_link_deduplicating_per_cu.
Fixes a double free error in the CTF linking process when an error occurs during input processing.
This commit corrects a double free error in the ctf_link_deduplicating_per_cu function within libctf/ctf-link.c. The error occurred on the error path when ctf_next_destroy was mistakenly called twice. The fix ensures ctf_next_destroy is called only once, resolving the issue.
In Details
In libctf/ctf-link.c, the ctf_link_deduplicating_per_cu function previously had an error path that could lead to a double free of a ctf_symbol_type if ctf_link_deduplicating_open_inputs failed. This was because ctf_next_destroy was called before the goto err_open_inputs which also implicitly handled cleanup. The fix removes the redundant call.
For Context
- CTF
- Compact Type Format, a data format for storing type information in object files, primarily used by DWARF.
- libctf
- The library that implements the Compact Type Format parsing and manipulation.
- double free
- A memory corruption error where the same memory block is freed more than once, leading to undefined behavior.