libctf: free ctf_dynsyms properly

In the "no symbols" case (commonplace for executables), we were freeing
the ctf_dynsyms using free(), instead of ctf_dynhash_destroy(), leaking
a little memory.

(This is harmless in the common case of ld usage, but libctf might be
used by persistent processes too.)

libctf/ChangeLog
2021-03-02  Nick Alcock  <nick.alcock@oracle.com>

	* ctf-link.c (ctf_link_shuffle_syms): Free ctf_dynsyms properly.
This commit is contained in:
Nick Alcock 2021-03-02 15:10:05 +00:00
parent cf6a0b989a
commit 8e7e446446
2 changed files with 5 additions and 1 deletions

View file

@ -1580,7 +1580,7 @@ ctf_link_shuffle_syms (ctf_dict_t *fp)
if (!ctf_dynhash_elements (fp->ctf_dynsyms))
{
ctf_dprintf ("No symbols: not a final link.\n");
free (fp->ctf_dynsyms);
ctf_dynhash_destroy (fp->ctf_dynsyms);
fp->ctf_dynsyms = NULL;
return 0;
}