Skip to content

Commit a813294

Browse files
committed
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: #14178 Ref: #13098 PR-URL: #14666 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
1 parent 1f16c43 commit a813294

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/node_zlib.cc

+1
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ class ZCtx : public AsyncWrap {
562562
delete[] dictionary;
563563
ctx->dictionary_ = nullptr;
564564
}
565+
ctx->mode_ = NONE;
565566
ctx->env()->ThrowError("Init error");
566567
}
567568
}

0 commit comments

Comments
 (0)