Skip to content

Commit

Permalink
zlib: fix use after null when calling .close
Browse files Browse the repository at this point in the history
An internal zlib error may cause _handle to be set to null.
Close now will check if there is a _handle prior to calling .close on
it.

PR-URL: #5982
Fixes: #6034
Reviewed-By: Brian White <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
lightsofapollo authored and Myles Borins committed Apr 20, 2016
1 parent abd101b commit bad006f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/zlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,9 @@ Zlib.prototype.close = function(callback) {

this._closed = true;

this._handle.close();
if (this._handle) {
this._handle.close();
}

process.nextTick(emitCloseNT, this);
};
Expand Down

0 comments on commit bad006f

Please sign in to comment.