mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-18 11:29:31 -04:00
corrected invalid memory read due to bad deletion method in std::map
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2268 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
365ef569dc
commit
272d9845a6
1 changed files with 12 additions and 2 deletions
|
@ -290,14 +290,19 @@ void p3turtle::autoWash()
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
||||||
|
|
||||||
for(std::map<TurtleSearchRequestId,TurtleRequestInfo>::iterator it(_search_requests_origins.begin());it!=_search_requests_origins.end();++it)
|
for(std::map<TurtleSearchRequestId,TurtleRequestInfo>::iterator it(_search_requests_origins.begin());it!=_search_requests_origins.end();)
|
||||||
if(now > (time_t)(it->second.time_stamp + SEARCH_REQUESTS_LIFE_TIME))
|
if(now > (time_t)(it->second.time_stamp + SEARCH_REQUESTS_LIFE_TIME))
|
||||||
{
|
{
|
||||||
#ifdef P3TURTLE_DEBUG
|
#ifdef P3TURTLE_DEBUG
|
||||||
std::cerr << " removed search request " << (void *)it->first << ", timeout." << std::endl ;
|
std::cerr << " removed search request " << (void *)it->first << ", timeout." << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
|
std::map<TurtleSearchRequestId,TurtleRequestInfo>::iterator tmp(it) ;
|
||||||
|
++tmp ;
|
||||||
_search_requests_origins.erase(it) ;
|
_search_requests_origins.erase(it) ;
|
||||||
|
it = tmp ;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tunnel requests
|
// Tunnel requests
|
||||||
|
@ -305,14 +310,19 @@ void p3turtle::autoWash()
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
||||||
|
|
||||||
for(std::map<TurtleTunnelRequestId,TurtleRequestInfo>::iterator it(_tunnel_requests_origins.begin());it!=_tunnel_requests_origins.end();++it)
|
for(std::map<TurtleTunnelRequestId,TurtleRequestInfo>::iterator it(_tunnel_requests_origins.begin());it!=_tunnel_requests_origins.end();)
|
||||||
if(now > (time_t)(it->second.time_stamp + TUNNEL_REQUESTS_LIFE_TIME))
|
if(now > (time_t)(it->second.time_stamp + TUNNEL_REQUESTS_LIFE_TIME))
|
||||||
{
|
{
|
||||||
#ifdef P3TURTLE_DEBUG
|
#ifdef P3TURTLE_DEBUG
|
||||||
std::cerr << " removed tunnel request " << (void *)it->first << ", timeout." << std::endl ;
|
std::cerr << " removed tunnel request " << (void *)it->first << ", timeout." << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
|
std::map<TurtleTunnelRequestId,TurtleRequestInfo>::iterator tmp(it) ;
|
||||||
|
++tmp ;
|
||||||
_tunnel_requests_origins.erase(it) ;
|
_tunnel_requests_origins.erase(it) ;
|
||||||
|
it = tmp ;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
++it ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tunnels.
|
// Tunnels.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue