libctf: fix double-free on ctf_compress_write error path
authorNick Alcock <nick.alcock@oracle.com>
Sat, 13 Jul 2019 19:44:38 +0000 (20:44 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Thu, 3 Oct 2019 16:04:55 +0000 (17:04 +0100)
We were freeing the compressed data buffer twice if compression failed.

v4: Fix commit message.
v5: fix tabdamage.

libctf/
* ctf-create.c (ctf_compress_write): Fix double-free.

libctf/ChangeLog
libctf/ctf-create.c

index 04939431173bb5aea69d7b26275969643b125a23..9e72d84ddc6f7b7a33489d8121a2ae0a22314c2b 100644 (file)
@@ -1,3 +1,7 @@
+2019-07-13  Nick Alcock  <nick.alcock@oracle.com>
+
+       * ctf-create.c (ctf_compress_write): Fix double-free.
+
 2019-07-13  Nick Alcock  <nick.alcock@oracle.com>
 
        * ctf-archive.c (ctf_arc_write): Split off, and reimplement in terms
index 09cd8d57a52daceb1de91ef5ea8ed69239428132..d75de916eaeca1db14e06c400ac205085906f1a1 100644 (file)
@@ -1997,7 +1997,6 @@ ctf_compress_write (ctf_file_t *fp, int fd)
     {
       ctf_dprintf ("zlib deflate err: %s\n", zError (rc));
       err = ctf_set_errno (fp, ECTF_COMPRESS);
-      ctf_free (buf);
       goto ret;
     }