gas tc_gen_reloc memory leaks

This makes all the tc_gen_reloc functions and the associated array in
write.c:write_relocs use notes_alloc rather than malloc.  tc-hppa.c
tc_gen_reloc gets a few more changes, deleting some dead code, and
tidying code that duplicates prior initialisation.
This commit is contained in:
Alan Modra
2025-01-01 22:49:04 +10:30
parent 443101612d
commit 3fb6f5457e
67 changed files with 282 additions and 339 deletions

View File

@@ -1032,11 +1032,10 @@ tc_gen_reloc (asection *sec, fixS *fx)
|| fx->fx_r_type == BFD_RELOC_M32C_RL_1ADDR
|| fx->fx_r_type == BFD_RELOC_M32C_RL_2ADDR)
{
arelent * reloc;
arelent *reloc;
reloc = XNEW (arelent);
reloc->sym_ptr_ptr = XNEW (asymbol *);
reloc = notes_alloc (sizeof (arelent));
reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fx->fx_addsy);
reloc->address = fx->fx_frag->fr_address + fx->fx_where;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fx->fx_r_type);