Skip to content

Commit a1f9929

Browse files
addaleaxMylesBorins
authored andcommittedOct 25, 2017
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 Backport-PR-URL: #14860 PR-URL: #14666 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]>
1 parent 31bf595 commit a1f9929

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
@@ -480,6 +480,7 @@ class ZCtx : public AsyncWrap {
480480
delete[] dictionary;
481481
ctx->dictionary_ = nullptr;
482482
}
483+
ctx->mode_ = NONE;
483484
ctx->env()->ThrowError("Init error");
484485
}
485486
}

0 commit comments

Comments
 (0)
Please sign in to comment.