diff options
author | Matt Lavin <matt.lavin@gmail.com> | 2016-05-24 11:27:00 -0400 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2016-05-28 21:33:37 +0200 |
commit | 313ef544173965309a5b24e3bf3a7f57af397c01 (patch) | |
tree | f7760f12d6d7293a7a7c4f05998e5078559c26dd /lib | |
parent | da12b10005e9ab4e52feb4101ac0ba373d290ad6 (diff) | |
download | android-node-v8-313ef544173965309a5b24e3bf3a7f57af397c01.tar.gz android-node-v8-313ef544173965309a5b24e3bf3a7f57af397c01.tar.bz2 android-node-v8-313ef544173965309a5b24e3bf3a7f57af397c01.zip |
zlib: release callback and buffer after processing
PR-URL: https://github.com/nodejs/node/pull/6955
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yuval Brik <yuval@brik.org.il>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/zlib.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/zlib.js b/lib/zlib.js index 6d9f47dca2..ffb7ba6c69 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -574,6 +574,16 @@ Zlib.prototype._processChunk = function(chunk, flushFlag, cb) { req.callback = callback; function callback(availInAfter, availOutAfter) { + // When the callback is used in an async write, the callback's + // context is the `req` object that was created. The req object + // is === this._handle, and that's why it's important to null + // out the values after they are done being used. `this._handle` + // can stay in memory longer than the callback and buffer are needed. + if (this) { + this.buffer = null; + this.callback = null; + } + if (self._hadError) return; |