aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2012-11-24 15:24:36 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2012-11-24 15:27:14 +0100
commit4cb17cb219b3a2540b40458ed253695b3626a803 (patch)
tree6c0fe205c64738eef4a059e5e02f173682d326ca /lib
parentfb5c7f03a040a4eb3684f0a9cff3141d959ea735 (diff)
downloadandroid-node-v8-4cb17cb219b3a2540b40458ed253695b3626a803.tar.gz
android-node-v8-4cb17cb219b3a2540b40458ed253695b3626a803.tar.bz2
android-node-v8-4cb17cb219b3a2540b40458ed253695b3626a803.zip
net: fix net.connect() resource leak
The 'connect' event listener was attached with .on(), which blocked it from getting garbage collected. Use .once() instead. Fixes #4308.
Diffstat (limited to 'lib')
-rw-r--r--lib/net.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/net.js b/lib/net.js
index efed0cacde..f8b77b2df6 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -665,7 +665,7 @@ Socket.prototype.connect = function(options, cb) {
}
if (typeof cb === 'function') {
- self.on('connect', cb);
+ self.once('connect', cb);
}
timers.active(this);