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: nodejs#14178
Ref: nodejs#13098
  • Loading branch information
addaleax committed Aug 7, 2017
1 parent 3f98b0f commit 64da7ab
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 64da7ab

Please sign in to comment.