diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2019-07-13 20:44:38 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2019-09-23 14:12:54 +0100 |
commit | 01cc754d45d8d6416a0b5462d0645efd448a95b3 (patch) | |
tree | 6afeff18263d1be0d5f936ea1e3837fbfd7680ef | |
parent | 1ba0a754ad8c035eac5f7476002ca32b6fd560ec (diff) | |
download | binutils-01cc754d45d8d6416a0b5462d0645efd448a95b3.zip binutils-01cc754d45d8d6416a0b5462d0645efd448a95b3.tar.gz binutils-01cc754d45d8d6416a0b5462d0645efd448a95b3.tar.bz2 |
libctf: fix double-free on ctf_compress_write error path
We were freeing the compressed data buffer twice if compression failed.
libctf/
* ctf-create.c (ctf_compress_write): Fix double-free.
-rw-r--r-- | libctf/ChangeLog | 4 | ||||
-rw-r--r-- | libctf/ctf-create.c | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog index bb75f9d..1315f4d 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 6189042..76304f7 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; } |