Skip to content

Commit e79c054

Browse files
addaleaxMylesBorins
authored andcommitted
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 5ba65f2 commit e79c054

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
@@ -541,6 +541,7 @@ class ZCtx : public AsyncWrap {
541541
delete[] dictionary;
542542
ctx->dictionary_ = nullptr;
543543
}
544+
ctx->mode_ = NONE;
544545
ctx->env()->ThrowError("Init error");
545546
}
546547
}

0 commit comments

Comments
 (0)