Skip to content

Commit

Permalink
Clear QuicChromiumPacketReaders before closing sockets in QuicChromiu…
Browse files Browse the repository at this point in the history
…mClientSession

QuicChromiumPacketReader must not outlive DatagramClientSocket
because readers have unowned raw pointers to sockets.

Bug: 1449478
Change-Id: I9e28d3a0617e27614451e3b2d8e4cf3e2e6d3145
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4572060
Reviewed-by: Nidhi Jaju <nidhijaju@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1150218}
  • Loading branch information
bashi authored and Chromium LUCI CQ committed May 29, 2023
1 parent 3793eae commit 4e46337
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/quic/quic_chromium_client_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2129,6 +2129,10 @@ void QuicChromiumClientSession::OnConnectionClosed(
}

CHECK_EQ(sockets_.size(), packet_readers_.size());
// Packet readers must not outlive sockets. Clear them before deleting sockets
// below.
packet_readers_.clear();

bool socket_found_in_writer = false;
for (auto& socket : sockets_) {
socket->Close();
Expand Down

0 comments on commit 4e46337

Please sign in to comment.