Skip to content

Commit

Permalink
http: clean up HttpParser correctly
Browse files Browse the repository at this point in the history
Remove reference to kOnMessageBegin from HttpParser
to avoid leaking Server instances in FreeList.

PR-URL: #39292
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
  • Loading branch information
sokra authored and targos committed Jul 11, 2021
1 parent 165130a commit ac7184d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/_http_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ let debug = require('internal/util/debuglog').debuglog('http', (fn) => {

const kIncomingMessage = Symbol('IncomingMessage');
const kRequestTimeout = Symbol('RequestTimeout');
const kOnMessageBegin = HTTPParser.kOnMessageBegin | 0;
const kOnHeaders = HTTPParser.kOnHeaders | 0;
const kOnHeadersComplete = HTTPParser.kOnHeadersComplete | 0;
const kOnBody = HTTPParser.kOnBody | 0;
Expand Down Expand Up @@ -239,6 +240,7 @@ function cleanParser(parser) {
parser.incoming = null;
parser.outgoing = null;
parser.maxHeaderPairs = MAX_HEADER_PAIRS;
parser[kOnMessageBegin] = null;
parser[kOnExecute] = null;
parser[kOnTimeout] = null;
parser._consumed = false;
Expand Down

0 comments on commit ac7184d

Please sign in to comment.