diff --git a/src/nxt_brotli.c b/src/nxt_brotli.c index 773b8b6f2..c69d977e0 100644 --- a/src/nxt_brotli.c +++ b/src/nxt_brotli.c @@ -46,14 +46,14 @@ nxt_brotli_compress(nxt_http_comp_compressor_ctx_t *ctx, const uint8_t *in_buf, &in_len, &in_buf, &out_bytes, &out_buf, NULL); if (!ok) { - return -1; + goto out_err_free; } ok = BrotliEncoderCompressStream(brotli, BROTLI_OPERATION_FLUSH, &in_len, &in_buf, &out_bytes, &out_buf, NULL); if (!ok) { - return -1; + goto out_err_free; } if (last) { @@ -61,13 +61,18 @@ nxt_brotli_compress(nxt_http_comp_compressor_ctx_t *ctx, const uint8_t *in_buf, &in_len, &in_buf, &out_bytes, &out_buf, NULL); if (!ok) { - return -1; + goto out_err_free; } BrotliEncoderDestroyInstance(brotli); } return out_len - out_bytes; + +out_err_free: + BrotliEncoderDestroyInstance(brotli); + + return -1; } diff --git a/src/nxt_http_compression.c b/src/nxt_http_compression.c index f9a94d055..079eceef2 100644 --- a/src/nxt_http_compression.c +++ b/src/nxt_http_compression.c @@ -195,7 +195,6 @@ nxt_http_comp_compress_app_response(nxt_task_t *task, nxt_http_request_t *r, } buf->data = (*b)->data; - buf->parent = (*b)->parent; last = ctx->clen_sent + in_len == ctx->resp_clen;