Skip to content

Commit 1e569f4

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 <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]>
1 parent 1e33f92 commit 1e569f4

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
@@ -557,6 +557,7 @@ class ZCtx : public AsyncWrap {
557557
delete[] dictionary;
558558
ctx->dictionary_ = nullptr;
559559
}
560+
ctx->mode_ = NONE;
560561
ctx->env()->ThrowError("Init error");
561562
}
562563

0 commit comments

Comments
 (0)