Author: sayer
Date: 2008-12-19 20:32:36 +0100 (Fri, 19 Dec 2008)
New Revision: 1218

Modified:
   branches/1.0.0/core/AmCallWatcher.cpp
Log:
fixing a severe bug that can cause crash under high load (backport from trunk 
r1217)


Modified: branches/1.0.0/core/AmCallWatcher.cpp
===================================================================
--- branches/1.0.0/core/AmCallWatcher.cpp       2008-12-19 19:31:25 UTC (rev 
1217)
+++ branches/1.0.0/core/AmCallWatcher.cpp       2008-12-19 19:32:36 UTC (rev 
1218)
@@ -189,11 +189,16 @@
     bool erased = false;
 
     mut.lock();
-    for (AmCallWatcher::CallStatusTimedMap::iterator it = garbage.begin(); 
-        it != garbage.end(); it++) {
+    AmCallWatcher::CallStatusTimedMap::iterator it = garbage.begin(); 
+    while (it != garbage.end()) {
       if (it->second.second < now.tv_sec) {
-       garbage.erase(it); // map::erase does not invalidate map::iterator
+       AmCallWatcher::CallStatusTimedMap::iterator d_it = it;
+       it++;
+       delete (d_it->second.first);
+       garbage.erase(d_it);    
        erased = true;
+      } else {
+       it++;
       }
     }
     if (erased){

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to