[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ccrtp-devel] Broken removeDestinationFromList()
From: |
Martin Mainka |
Subject: |
[Ccrtp-devel] Broken removeDestinationFromList() |
Date: |
Fri, 19 Oct 2007 19:11:13 +0200 |
Hi,
The removeDestinationFromList() function is broken (Increment on an
undefined iterator) after destList.erase(i).
I send a correction that does increment before iterator i becomes invalid.
With this the problem is solved.
bool
DestinationListHandler::removeDestinationFromList(const InetAddress& ia,
tpport_t dataPort,
tpport_t controlPort)
{
bool result = false;
writeLockDestinationList();
TransportAddress* tmp;
std::list<TransportAddress*>::iterator i;
for ( i = destList.begin(); destList.end() != i && !result;)
<-------------
{
tmp = *i;
if ( ia == tmp->getNetworkAddress() &&
dataPort == tmp->getDataTransportPort() &&
controlPort == tmp->getControlTransportPort() )
{
// matches. -> remove it.
result = true;
destList.erase(i++); <-------------
delete tmp;
}
else
{
i++; <-------------
}
}
unlockDestinationList();
return result;
}
With best regards
Martin Mainka
- [Ccrtp-devel] Broken removeDestinationFromList(),
Martin Mainka <=