Skip to content

Commit 9312872

Browse files
committed
http2: be sure to destroy the Http2Stream
1 parent ce38c49 commit 9312872

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/node_http2.cc

Lines changed: 4 additions & 1 deletion
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)