From 6a810548bb9ea0f950ad8cf0a2c008e1cd8fcf23 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 1 Jul 2019 09:16:48 +0200 Subject: Fix memory leak in gzip compressor Don't allocate the compressor structure twice. Bug found using scan-build. Signed-off-by: David Oberhollenzer --- lib/comp/gzip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/comp/gzip.c b/lib/comp/gzip.c index 732245f..379a231 100644 --- a/lib/comp/gzip.c +++ b/lib/comp/gzip.c @@ -304,10 +304,10 @@ fail_value: compressor_t *create_gzip_compressor(bool compress, size_t block_size, char *options) { - gzip_compressor_t *gzip = calloc(1, sizeof(*gzip)); - compressor_t *base = (compressor_t *)gzip; int window = GZIP_DEFAULT_WINDOW; int level = GZIP_DEFAULT_LEVEL; + gzip_compressor_t *gzip; + compressor_t *base; int flags = 0; int ret; -- cgit v1.2.3