http2: fix memory leak for uncommon headers

Fix a memory leak that occurs with header names that are
short and not present in the static table of default headers.

PR-URL: https://github.com/nodejs/node/pull/21336
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
This commit is contained in:
Anna Henningsen 2018-06-15 02:15:04 +02:00
parent 1da88552ea
commit 1e54c24132
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9

View File

@ -1203,6 +1203,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);