Skip to content

Commit f699a74

Browse files
jasnellMylesBorins
authored andcommitted
http2: be sure to destroy the Http2Stream
PR-URL: #17406 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Backport-PR-URL: #18050
1 parent 30e75e6 commit f699a74

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/node_http2.cc

+4-1
Original file line numberDiff line numberDiff line change
@@ -619,13 +619,16 @@ inline int Http2Session::OnStreamClose(nghttp2_session* handle,
619619
if (stream != nullptr) {
620620
stream->Close(code);
621621
// It is possible for the stream close to occur before the stream is
622-
// ever passed on to the javascript side. If that happens, ignore this.
622+
// ever passed on to the javascript side. If that happens, skip straight
623+
// to destroying the stream
623624
Local<Value> fn =
624625
stream->object()->Get(context, env->onstreamclose_string())
625626
.ToLocalChecked();
626627
if (fn->IsFunction()) {
627628
Local<Value> argv[1] = { Integer::NewFromUnsigned(isolate, code) };
628629
stream->MakeCallback(fn.As<Function>(), arraysize(argv), argv);
630+
} else {
631+
stream->Destroy();
629632
}
630633
}
631634
return 0;

0 commit comments

Comments
 (0)