libctf: free ctf_dynsyms properly
authorNick Alcock <nick.alcock@oracle.com>
Tue, 2 Mar 2021 15:10:05 +0000 (15:10 +0000)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 2 Mar 2021 15:10:09 +0000 (15:10 +0000)
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.

libctf/ChangeLog
libctf/ctf-link.c

index f0a1754d5ec95a270ffc1f3187b6e2db598d3bab..8fa98c68a82c6d20e189532b3a095730ee0c09c3 100644 (file)
@@ -1,3 +1,7 @@
+2021-03-02  Nick Alcock  <nick.alcock@oracle.com>
+
+       * ctf-link.c (ctf_link_shuffle_syms): Free ctf_dynsyms properly.
+
 2021-03-02  Nick Alcock  <nick.alcock@oracle.com>
 
        * ctf-dump.c (ctf_dump_format_type): Fix signed/unsigned confusion.
index 05733a0cb7d821e76cddcbeeb9aeb40b8e70b4a7..882d4297e4fc8b75e8744b25803b9df6bd5d6bb7 100644 (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;
     }
This page took 0.028939 seconds and 4 git commands to generate.