Index: webrtc/p2p/base/turnport.cc |
diff --git a/webrtc/p2p/base/turnport.cc b/webrtc/p2p/base/turnport.cc |
index 5e88365a83d615bdbc2e19ffe62694444ee20039..a1a13cbc01454dd040db89dde3c8cdce68c189ce 100644 |
--- a/webrtc/p2p/base/turnport.cc |
+++ b/webrtc/p2p/base/turnport.cc |
@@ -907,6 +907,11 @@ TurnEntry* TurnPort::FindEntry(int channel_id) const { |
return (it != entries_.end()) ? *it : NULL; |
} |
+bool TurnPort::EntryExists(TurnEntry* e) { |
+ auto it = std::find(entries_.begin(), entries_.end(), e); |
+ return it != entries_.end(); |
+} |
+ |
void TurnPort::CreateOrRefreshEntry(const rtc::SocketAddress& addr) { |
TurnEntry* entry = FindEntry(addr); |
if (entry == nullptr) { |
@@ -928,6 +933,9 @@ void TurnPort::DestroyEntry(TurnEntry* entry) { |
void TurnPort::DestroyEntryIfNotCancelled(TurnEntry* entry, |
uint32_t timestamp) { |
+ if (!EntryExists(entry)) { |
+ return; |
+ } |
bool cancelled = timestamp != entry->destruction_timestamp(); |
if (!cancelled) { |
DestroyEntry(entry); |