From 367b848bab28906ac25813de8d3d759db5da34d9 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 27 Nov 2017 13:20:29 -0800 Subject: [PATCH] http2: be sure to destroy the Http2Stream PR-URL: https://github.com/nodejs/node/pull/17406 Reviewed-By: Matteo Collina Reviewed-By: Anna Henningsen Reviewed-By: Anatoli Papirovski Backport-PR-URL: https://github.com/nodejs/node/pull/18050 --- src/node_http2.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/node_http2.cc b/src/node_http2.cc index f8b530c20a16cf..1ce3c5cb46e231 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -619,13 +619,16 @@ inline int Http2Session::OnStreamClose(nghttp2_session* handle, if (stream != nullptr) { stream->Close(code); // It is possible for the stream close to occur before the stream is - // ever passed on to the javascript side. If that happens, ignore this. + // ever passed on to the javascript side. If that happens, skip straight + // to destroying the stream Local fn = stream->object()->Get(context, env->onstreamclose_string()) .ToLocalChecked(); if (fn->IsFunction()) { Local argv[1] = { Integer::NewFromUnsigned(isolate, code) }; stream->MakeCallback(fn.As(), arraysize(argv), argv); + } else { + stream->Destroy(); } } return 0;