summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Nagy <robertnagy@Roberts-MacBook-Pro.local>2019-08-21 15:12:48 +0200
committerRich Trott <rtrott@gmail.com>2019-08-23 06:28:36 -0700
commitf39ad8a91fe43a4bfc427915a5bf2b749f00c048 (patch)
treed033f738325ec1f19c63af9f770c2c75d58810da /lib
parent4e188b3c63f0488be03a1f723b9b50720c76fed4 (diff)
downloadandroid-node-v8-f39ad8a91fe43a4bfc427915a5bf2b749f00c048.tar.gz
android-node-v8-f39ad8a91fe43a4bfc427915a5bf2b749f00c048.tar.bz2
android-node-v8-f39ad8a91fe43a4bfc427915a5bf2b749f00c048.zip
http: fix event listener leak
Fixes: https://github.com/nodejs/node/issues/29239 PR-URL: https://github.com/nodejs/node/pull/29245 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/_http_client.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/_http_client.js b/lib/_http_client.js
index 67e14fae20..04d5a3f56e 100644
--- a/lib/_http_client.js
+++ b/lib/_http_client.js
@@ -506,6 +506,7 @@ function socketOnData(d) {
!statusIsInformational(parser.incoming.statusCode)) {
socket.removeListener('data', socketOnData);
socket.removeListener('end', socketOnEnd);
+ socket.removeListener('drain', ondrain);
freeParser(parser, req, socket);
}
}
@@ -613,6 +614,7 @@ function responseKeepAlive(res, req) {
}
socket.removeListener('close', socketCloseListener);
socket.removeListener('error', socketErrorListener);
+ socket.removeListener('drain', ondrain);
socket.once('error', freeSocketErrorListener);
// There are cases where _handle === null. Avoid those. Passing null to
// nextTick() will call getDefaultTriggerAsyncId() to retrieve the id.