Browse Source

zlib: fix use after null when calling .close

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: https://github.com/nodejs/node/pull/5982
Fixes: https://github.com/nodejs/node/issues/6034
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
v4.x
James Lal 9 years ago
committed by Myles Borins
parent
commit
48684af55f
  1. 4
      lib/zlib.js

4
lib/zlib.js

@ -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);
};

Loading…
Cancel
Save