bfd: alpha: Fix crash caused by double free with --no-keep-memory
authorJames Clarke <jrtc27@jrtc27.com>
Tue, 3 Jan 2017 16:15:15 +0000 (16:15 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 3 Jan 2017 22:23:43 +0000 (08:53 +1030)
commitae4fda663812129df67e3a70691787060242c0f9
tree7f1b2ec83550b9c79e1b50da727b8204ddeb6593
parentcc917fd93d2a836adfd61b91df021cf835e88fd1
bfd: alpha: Fix crash caused by double free with --no-keep-memory

Without this, ld has been seen to crash in libc when freeing tsec_free:

*** Error in `/usr/bin/ld': double free or corruption (!prev): 0x0000000120ceb6a0 ***

_bfd_elf_link_read_relocs will always return the cached value if
present, even if keep_memory is false, therefore setting tsec_free to
NULL only when keep_memory is true is not sufficient.

* elf64-alpha.c (elf64_alpha_relax_opt_call): Don't set tsec_free
if relocs are cached.
bfd/ChangeLog
bfd/elf64-alpha.c