binutils Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
x86/disasm

X86/disasm: Avoid potential memory leak in annotation buffers

The x86 disassembler now frees annotation buffers correctly, preventing a potential memory leak.

A potential memory leak in the x86 disassembler’s annotation logic was fixed by moving the free() call outside of a conditional block where it could be skipped. This ensures that the annotation buffer is always freed, preventing memory leaks during disassembly.

In Details

The x86 disassembler uses annotation buffers to store symbol names associated with immediate values. The asprintf() function may allocate memory even when it returns an error, leading to a leak if free() is not always called. This commit addresses a FIXME in opcodes/i386-dis.c by ensuring the annotation buffer is always freed.

For Context

A disassembler translates machine code back into human-readable assembly language. Memory leaks occur when a program allocates memory but fails to release it, potentially leading to performance issues or crashes. This change fixes a memory leak in the x86 disassembler, improving its stability and reliability.

Filed Under: disassemblerx86memory leak