Skip to content

Commit 546797f

Browse files
authored
quic: prevent copying ngtcp2_cid
The existing code explicitly uses the CID(const ngtcp2_cid*) constructor that does not copy the given ngtcp2_cid, but the range-based for loop still unnecessarily copies the ngtcp2_cid. Use auto& to avoid copying. PR-URL: #48561 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
1 parent 900ae1b commit 546797f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/quic/session.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ void Session::Destroy() {
643643
endpoint_->DisassociateCID(config_.dcid);
644644
endpoint_->DisassociateCID(config_.preferred_address_cid);
645645

646-
for (auto cid : cids) endpoint_->DisassociateCID(CID(&cid));
646+
for (const auto& cid : cids) endpoint_->DisassociateCID(CID(&cid));
647647

648648
for (const auto& token : tokens) {
649649
if (token.token_present)

0 commit comments

Comments
 (0)