Skip to content

Commit

Permalink
zlib: fix crash when initializing failed
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
addaleax committed Aug 9, 2017
1 parent 1e33f92 commit 1e569f4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/node_zlib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ class ZCtx : public AsyncWrap {
delete[] dictionary;
ctx->dictionary_ = nullptr;
}
ctx->mode_ = NONE;
ctx->env()->ThrowError("Init error");
}

Expand Down

0 comments on commit 1e569f4

Please sign in to comment.