summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJames Lal <james@silklabs.com>2016-03-31 14:16:30 -0700
committerAnna Henningsen <anna@addaleax.net>2016-04-19 08:46:54 +0200
commitc7fef3d3b8763d55a238786b56f91939f10f2c36 (patch)
tree0a7e91763e6956d593b381d5b69cff35677898af /lib
parente38bade82801645d8cc1010e3f4e9826052244cb (diff)
downloadnode-new-c7fef3d3b8763d55a238786b56f91939f10f2c36.tar.gz
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/zlib.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/zlib.js b/lib/zlib.js
index 4a7c1ef153..3915e5ddab 100644
--- a/lib/zlib.js
+++ b/lib/zlib.js
@@ -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) {