libctf: do not crash when CTF symbol or variable linking fails
authorNick Alcock <nick.alcock@oracle.com>
Fri, 20 Nov 2020 13:34:04 +0000 (13:34 +0000)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 20 Nov 2020 13:34:13 +0000 (13:34 +0000)
commitef21dd3bcffd350f0bf27386f1eafe8095d8feec
tree8c3b7fb17d3ac94f9d1bfc6df3ccfa440d39c606
parent8f235c90a287ee961153dd94f5ca28b033ebb668
libctf: do not crash when CTF symbol or variable linking fails

When linking fails, we delete all the generated outputs, but we fail to
remove them from the ctf_link_outputs hash we stuck them in before doing
symbol and variable section linking (which we had to do because that's
where ctf_create_per_cu, used by both, looks for them).  This leaves
stale pointers to freed memory behind, and crashes soon follow.

Fix obvious.

libctf/ChangeLog
2020-11-20  Nick Alcock  <nick.alcock@oracle.com>

* ctf-link.c (ctf_link_deduplicating): Clean up the ctf_link_outputs
hash on error.
libctf/ChangeLog
libctf/ctf-link.c