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 Sep 4, 2021
1 parent f70fd00 commit 5459f4a
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 @@ -45,6 +45,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 @@ -238,6 +239,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 5459f4a

Please sign in to comment.