[MOAB-dev] r1394 - MOAB/trunk

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Thu Nov 15 09:02:16 CST 2007


Author: kraftche
Date: 2007-11-15 09:02:15 -0600 (Thu, 15 Nov 2007)
New Revision: 1394

Modified:
   MOAB/trunk/TypeSequenceManager.cpp
Log:
fix memory leaks

Modified: MOAB/trunk/TypeSequenceManager.cpp
===================================================================
--- MOAB/trunk/TypeSequenceManager.cpp	2007-11-14 23:17:58 UTC (rev 1393)
+++ MOAB/trunk/TypeSequenceManager.cpp	2007-11-15 15:02:15 UTC (rev 1394)
@@ -570,8 +570,12 @@
     return MB_ENTITY_NOT_FOUND;
   
   if (seq->start_handle() == h) {
-    if (seq->end_handle() != h) 
-      return seq->pop_front(1);
+    if (seq->end_handle() != h) {
+      if (seq->using_entire_data())
+        availableList.insert( seq->data() );
+      seq->pop_front(1);
+      return MB_SUCCESS;
+    }
     SequenceData* data = seq->data();
     bool delete_data;
     MBErrorCode rval = remove_sequence( seq, delete_data );
@@ -582,14 +586,21 @@
       delete data;
     return MB_SUCCESS;
   }
-  else if (seq->end_handle() == h)
-    return seq->pop_back(1);
+  else if (seq->end_handle() == h) {
+    if (seq->using_entire_data())
+      availableList.insert( seq->data() );
+    seq->pop_back(1);
+    return MB_SUCCESS;
+  }
   else {
     iterator i = lower_bound( h );
+    if ((*i)->using_entire_data())
+      availableList.insert( (*i)->data() );
     i = split_sequence( i, h );
     seq = *i;
     assert(seq->start_handle() == h);
-    return seq->pop_front(1);
+    seq->pop_front(1);
+    return MB_SUCCESS;
   }
 }
 
@@ -605,7 +616,7 @@
     
     // get first sequence intersecting range
   iterator i = lower_bound( first );
-  if (i == end())  // shouuldn't be possible given check_valid_handles call above.
+  if (i == end())  // shouldn't be possible given check_valid_handles call above.
     return MB_ENTITY_NOT_FOUND;
     
     // if range is entirely in interior of sequence, need to split sequence.




More information about the moab-dev mailing list