http leak: Null links from parser to req/res
authorisaacs <i@izs.me>
Thu, 3 May 2012 17:20:20 +0000 (10:20 -0700)
committerisaacs <i@izs.me>
Thu, 3 May 2012 17:20:45 +0000 (10:20 -0700)
lib/http.js

index 96f5b6a..06d98d0 100644 (file)
@@ -1079,6 +1079,7 @@ function ClientRequest(options, cb) {
 
   self._deferToConnect(null, null, function() {
     self._flush();
+    self = null;
   });
 
 }
@@ -1127,12 +1128,17 @@ ClientRequest.prototype.onSocket = function(socket) {
 
     var freeParser = function() {
       if (parser) {
-        parsers.free(parser);
+        parser.onIncoming = null;
         parser.socket.onend = null;
         parser.socket.ondata = null;
         parser.socket = null;
+        parser.incoming = null;
+        parsers.free(parser);
         parser = null;
       }
+      if (req) {
+        req.parser = null;
+      }
     };
 
     var errorListener = function(err) {