http2: fix memory leak on nghttp2 hd threshold · nodejs/node@7bf2be5 · GitHub
Skip to content

Commit 7bf2be5

Browse files
RafaelGSSdanielleadams
authored andcommitted
http2: fix memory leak on nghttp2 hd threshold
PR-URL: #41502 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
1 parent ee79e53 commit 7bf2be5

3 files changed

Lines changed: 72 additions & 0 deletions

File tree

src/node_http2.cc

Lines changed: 20 additions & 0 deletions

src/node_http2.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,10 @@ class Http2Stream : public AsyncWrap,
401401
size_t i = 0;
402402
for (const auto& header : current_headers_ )
403403
fn(header, i++);
404+
ClearHeaders();
405+
}
406+
407+
void ClearHeaders() {
404408
current_headers_.clear();
405409
}
406410

@@ -787,6 +791,8 @@ class Http2Session : public AsyncWrap,
787791
void HandleAltSvcFrame(const nghttp2_frame* frame);
788792
void HandleOriginFrame(const nghttp2_frame* frame);
789793

794+
void DecrefHeaders(const nghttp2_frame* frame);
795+
790796
// nghttp2 callbacks
791797
static int OnBeginHeadersCallback(
792798
nghttp2_session* session,
Lines changed: 46 additions & 0 deletions

0 commit comments

Comments
 (0)