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 May 17, 2016
1 parent 54747f1 commit 0cc1e0f
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 @@ -462,7 +462,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 0cc1e0f

Please sign in to comment.