Skip to content

Commit bd944e3

Browse files
lightsofapollojasnell
authored andcommittedApr 26, 2016
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 <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent c3ad97d commit bd944e3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎lib/zlib.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,10 @@ function _close(engine, callback) {
474474

475475
engine._closed = true;
476476

477-
engine._handle.close();
477+
// Caller may invoke .close after a zlib error (which will null _handle).
478+
if (engine._handle) {
479+
engine._handle.close();
480+
}
478481
}
479482

480483
function emitCloseNT(self) {

0 commit comments

Comments
 (0)
Please sign in to comment.