From e79c054f76b81a875787c683311f6817802545ee Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 7 Aug 2017 17:12:11 +0200 Subject: [PATCH] zlib: fix crash when initializing failed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unset `mode_` when initializing the zlib stream failed, so that we don’t try to call the zlib end functions (`deflateEnd()` etc.) when cleaning up in `ZCtx::Close()`. Fixes: https://github.com/nodejs/node/issues/14178 Ref: https://github.com/nodejs/node/pull/13098 PR-URL: https://github.com/nodejs/node/pull/14666 Reviewed-By: Refael Ackermann Reviewed-By: Colin Ihrig Reviewed-By: Alexey Orlenko --- src/node_zlib.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node_zlib.cc b/src/node_zlib.cc index bb149629c92f2f..31241e10c391db 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -541,6 +541,7 @@ class ZCtx : public AsyncWrap { delete[] dictionary; ctx->dictionary_ = nullptr; } + ctx->mode_ = NONE; ctx->env()->ThrowError("Init error"); } }