Skip to content

Commit

Permalink
http2: fix memory leak for uncommon headers
Browse files Browse the repository at this point in the history
Fix a memory leak that occurs with header names that are
short and not present in the static table of default headers.

PR-URL: nodejs#21336
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
  • Loading branch information
addaleax authored and kjin committed Aug 23, 2018
1 parent d6e531e commit 1665dfa
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/node_http2.h
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,7 @@ class ExternalHeader :
}

if (may_internalize && vec.len < 64) {
nghttp2_rcbuf_decref(buf);
// This is a short header name, so there is a good chance V8 already has
// it internalized.
return GetInternalizedString(env, vec);
Expand Down

0 comments on commit 1665dfa

Please sign in to comment.