[2/3] x86/disasm: avoid potentially leaking annotation buffers
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_binutils_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-arm |
success
|
Test passed
|
Commit Message
Address the FIXME there by moving the free() invocation out of the if().
@@ -11697,14 +11697,13 @@ oappend_immediate (instr_info *ins, bfd_
char * annotation = NULL;
- /* FIXME: Potential memory leak: strictly speaking asprintf()
- can return 0 whilst also having allocated some memory. */
if (asprintf (& annotation, " [%s]", sym->name) > 0)
{
/* Display the symbol associated with address 'imm'. */
cappend_with_style (ins, annotation, dis_style_symbol);
- free (annotation);
}
+
+ free (annotation);
}
/* Put DISP in BUF as signed hex number. */