Skip to content

Commit

Permalink
lib: fix zlib async callback after close
Browse files Browse the repository at this point in the history
Closing a zlib stream may throw an uncaught exception afterwards if
there was a pending callback still to be invoked. This adds a very
minimal fix to the issue as all of this code has been rewritten in later
versions.

Fixes: #15625
PR-URL: #16312
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
nakedible authored and MylesBorins committed Feb 11, 2018
1 parent d9f4b0f commit 9f24570
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/zlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ Zlib.prototype._processChunk = function(chunk, flushFlag, cb) {
this.callback = null;
}

if (self._hadError)
if (self._hadError || !self._handle)
return;

var have = availOutBefore - availOutAfter;
Expand Down

0 comments on commit 9f24570

Please sign in to comment.