mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
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>
This commit is contained in:
1 parent
c3ad97d3cc
commit
bd944e33ef
1 file changed
+4
-1
+4
-1
@@ -474,7 +474,10 @@ function _close(engine, callback) {
|
||||
|
||||
engine._closed = true;
|
||||
|
||||
engine._handle.close();
|
||||
// Caller may invoke .close after a zlib error (which will null _handle).
|
||||
if (engine._handle) {
|
||||
engine._handle.close();
|
||||
}
|
||||
}
|
||||
|
||||
function emitCloseNT(self) {
|
||||
|
||||
Reference in new issue
Block a user