From 64da7aba66b54d00fa1a804c151e15a82a8d6b04 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 --- src/node_zlib.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node_zlib.cc b/src/node_zlib.cc index 07cd526b1ea8b9..0793aca1d94cfa 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -557,6 +557,7 @@ class ZCtx : public AsyncWrap { delete[] dictionary; ctx->dictionary_ = nullptr; } + ctx->mode_ = NONE; ctx->env()->ThrowError("Init error"); }