summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2017-08-07 17:12:11 +0200
committerMyles Borins <myles.borins@gmail.com>2017-10-25 04:25:41 -0400
commita1f992975fee506a9c1c60887a689db16a512cef (patch)
tree436b39a2d97409f2fd796158ac97e9cd378aa892
parent31bf595b9417e2e3d45e9b291d6ba263ef7e288f (diff)
downloadnode-new-a1f992975fee506a9c1c60887a689db16a512cef.tar.gz
zlib: fix crash when initializing failed
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 Backport-PR-URL: https://github.com/nodejs/node/pull/14860 PR-URL: https://github.com/nodejs/node/pull/14666 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
-rw-r--r--src/node_zlib.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/node_zlib.cc b/src/node_zlib.cc
index 66a6a476a7..96c0376f89 100644
--- a/src/node_zlib.cc
+++ b/src/node_zlib.cc
@@ -480,6 +480,7 @@ class ZCtx : public AsyncWrap {
delete[] dictionary;
ctx->dictionary_ = nullptr;
}
+ ctx->mode_ = NONE;
ctx->env()->ThrowError("Init error");
}
}