mirror of
https://github.com/nodejs/node.git
synced 2025-04-29 22:40:57 +00:00
src: ensure to close stream when destroying session
Co-Authored-By: Anna Henningsen <anna@addaleax.net> PR-URL: https://github.com/nodejs-private/node-private/pull/561 Fixes: https://hackerone.com/reports/2319584 Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> CVE-ID: CVE-2024-27983
This commit is contained in:
parent
6590a8c4e4
commit
b25b5aca96
@ -605,6 +605,12 @@ Http2Session::Http2Session(Http2State* http2_state,
|
|||||||
Http2Session::~Http2Session() {
|
Http2Session::~Http2Session() {
|
||||||
CHECK(!is_in_scope());
|
CHECK(!is_in_scope());
|
||||||
Debug(this, "freeing nghttp2 session");
|
Debug(this, "freeing nghttp2 session");
|
||||||
|
// Ensure that all `Http2Stream` instances and the memory they hold
|
||||||
|
// on to are destroyed before the nghttp2 session is.
|
||||||
|
for (const auto& [id, stream] : streams_) {
|
||||||
|
stream->Detach();
|
||||||
|
}
|
||||||
|
streams_.clear();
|
||||||
// Explicitly reset session_ so the subsequent
|
// Explicitly reset session_ so the subsequent
|
||||||
// current_nghttp2_memory_ check passes.
|
// current_nghttp2_memory_ check passes.
|
||||||
session_.reset();
|
session_.reset();
|
||||||
|
Loading…
Reference in New Issue
Block a user