From 01cc754d45d8d6416a0b5462d0645efd448a95b3 Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Sat, 13 Jul 2019 20:44:38 +0100 Subject: [PATCH] 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. --- libctf/ChangeLog | 4 ++++ libctf/ctf-create.c | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libctf/ChangeLog b/libctf/ChangeLog index bb75f9d6423..1315f4dc384 100644 --- a/libctf/ChangeLog +++ b/libctf/ChangeLog @@ -1,3 +1,7 @@ +2019-07-13 Nick Alcock + + * ctf-create.c (ctf_compress_write): Fix double-free. + 2019-07-13 Nick Alcock * ctf-archive.c (ctf_arc_write): Split off, and reimplement in terms diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c index 6189042fdb0..76304f724c7 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; } -- 2.47.2