BUG/MINOR: compression: deinit zlib only when required
The zlib stream was deinitialized even when the init failed.
diff --git a/src/proto_http.c b/src/proto_http.c
index 4fc37ed..1836405 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -2103,6 +2103,8 @@
if (s->comp_algo->init(&s->comp_ctx, global.tune.comp_maxlevel) < 0)
goto fail;
+ s->flags |= SN_COMP_READY;
+
s->comp_ctx.cur_lvl = global.tune.comp_maxlevel;
/* remove Content-Length header */
@@ -2131,9 +2133,10 @@
return 1;
fail:
- if (s->comp_algo) {
+ if (s->flags & SN_COMP_READY) {
s->comp_algo->end(&s->comp_ctx);
s->comp_algo = NULL;
+ s->flags &= ~SN_COMP_READY;
}
return 0;
}