[binutils-gdb] libctf: fix double-free on ctf_compress_write error path
Jose E.Marchesi
jemarch@sourceware.org
Thu Oct 3 16:32:00 GMT 2019
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3dde2c915e2c68fdda36febac618595561ed87f8
commit 3dde2c915e2c68fdda36febac618595561ed87f8
Author: Nick Alcock <nick.alcock@oracle.com>
Date: Sat Jul 13 20:44:38 2019 +0100
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.
Diff:
---
libctf/ChangeLog | 4 ++++
libctf/ctf-create.c | 1 -
2 files changed, 4 insertions(+), 1 deletion(-)
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;
}
More information about the Binutils-cvs
mailing list