aboutsummaryrefslogtreecommitdiff
path: root/libctf
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2019-07-13 20:44:38 +0100
committerNick Alcock <nick.alcock@oracle.com>2019-10-03 17:04:55 +0100
commit3dde2c915e2c68fdda36febac618595561ed87f8 (patch)
tree7e723c7186e6400ad0a9160fca13276857d48758 /libctf
parent5537f9b9a3c46c3898e274a52f6bb0eb8d293bb8 (diff)
downloadgdb-3dde2c915e2c68fdda36febac618595561ed87f8.zip
gdb-3dde2c915e2c68fdda36febac618595561ed87f8.tar.gz
gdb-3dde2c915e2c68fdda36febac618595561ed87f8.tar.bz2
libctf: fix double-free on ctf_compress_write error path
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.
Diffstat (limited to 'libctf')
-rw-r--r--libctf/ChangeLog4
-rw-r--r--libctf/ctf-create.c1
2 files changed, 4 insertions, 1 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index 0493943..9e72d84 100644
--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,5 +1,9 @@
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
of...
(ctf_arc_write_fd): ... this new function.
diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c
index 09cd8d5..d75de91 100644
--- a/libctf/ctf-create.c
+++ b/libctf/ctf-create.c
@@ -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;
}