Skip to content

Commit 48684af

Browse files
lightsofapolloMyles Borins
authored and
Myles Borins
committed
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: #5982 Fixes: #6034 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent b8c9d6b commit 48684af

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/zlib.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,9 @@ Zlib.prototype.close = function(callback) {
462462

463463
this._closed = true;
464464

465-
this._handle.close();
465+
if (this._handle) {
466+
this._handle.close();
467+
}
466468

467469
process.nextTick(emitCloseNT, this);
468470
};

0 commit comments

Comments
 (0)