Skip to content
Snippets Groups Projects
Commit b7ae071c authored by Guillaume Roguez's avatar Guillaume Roguez Committed by Sébastien Blin
Browse files

fix: heap-use-after-free in eventLoop()


Second attempt to fix a heap-use-after-free found with ASAN.
First attempt is broken (commit b2e56f84)

Change-Id: I923963ec0a25d768c69c76d506d5bc5dedb6181f
Reviewed-by: default avatarSebastien Blin <sebastien.blin@savoirfairelinux.com>
parent c522096a
Branches
No related tags found
No related merge requests found
......@@ -646,9 +646,10 @@ DhtPeerConnector::Impl::eventLoop()
&& element.second
&& element.second->hasStreamWithId(id));});
if (it == servers_.end()) break;
auto peer = it->first.second; // tmp copy to prevent use-after-free below
servers_.erase(it);
connectedPeers_.erase(it->first.second);
turnEndpoints_.erase(it->first.second);
connectedPeers_.erase(peer);
turnEndpoints_.erase(peer);
}
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment