Author: sayer
Date: 2008-12-19 20:31:25 +0100 (Fri, 19 Dec 2008)
New Revision: 1217

Modified:
   trunk/core/AmCallWatcher.cpp
Log:
fixing a severe bug that can cause crash under high load


Modified: trunk/core/AmCallWatcher.cpp
===================================================================
--- trunk/core/AmCallWatcher.cpp        2008-12-19 19:23:26 UTC (rev 1216)
+++ trunk/core/AmCallWatcher.cpp        2008-12-19 19:31:25 UTC (rev 1217)
@@ -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