From 22d50ed4bdbe587ece107e0f29b05df80dcfaca6 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Wed, 5 May 2021 18:22:50 +0200 Subject: [PATCH] compression mode init fix --- src/lib/compress.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/compress.c b/src/lib/compress.c index bb32d95..f11d7a7 100644 --- a/src/lib/compress.c +++ b/src/lib/compress.c @@ -12,8 +12,10 @@ int compress_init(compress_ctx *ctx, int mode) { ctx->gzip = NULL; ctx->brotli = NULL; + ctx->mode = 0; int ret; if (mode & COMPRESS_GZ) { + ctx->mode |= COMPRESS_GZ; ctx->gzip = malloc(sizeof(z_stream)); ctx->gzip->zalloc = Z_NULL; ctx->gzip->zfree = Z_NULL; @@ -22,6 +24,7 @@ int compress_init(compress_ctx *ctx, int mode) { if (ret != Z_OK) return -1; } if (mode & COMPRESS_BR) { + ctx->mode |= COMPRESS_BR; ctx->brotli = BrotliEncoderCreateInstance(NULL, NULL, NULL); if (ctx->brotli == NULL) return -1; BrotliEncoderSetParameter(ctx->brotli, BROTLI_PARAM_MODE, BROTLI_MODE_GENERIC);