BIND 10 master, updated. 73372e3a10aef030bb33f2834357fe2f4a3bb481 [master] Corrected valgrind error reported in D2UpdateMgr unit test.

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Aug 7 19:17:44 UTC 2013


The branch, master has been updated
       via  73372e3a10aef030bb33f2834357fe2f4a3bb481 (commit)
      from  34081cbfbc9f0be52330015f8b58dfbbc7997ef2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 73372e3a10aef030bb33f2834357fe2f4a3bb481
Author: Thomas Markwalder <tmark at isc.org>
Date:   Wed Aug 7 15:15:58 2013 -0400

    [master] Corrected valgrind error reported in D2UpdateMgr unit test.
    
    D2UpdateMgr::checkFinishedTransaction was issuing an invalid read
    when attempting to prefix increment an iterator used in an std::map erase
    call.  This was flagged by valgrind and also core dumped under FreeBSD10.

-----------------------------------------------------------------------

Summary of changes:
 src/bin/d2/d2_update_mgr.cc |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/d2/d2_update_mgr.cc b/src/bin/d2/d2_update_mgr.cc
index d826649..e625c3e 100644
--- a/src/bin/d2/d2_update_mgr.cc
+++ b/src/bin/d2/d2_update_mgr.cc
@@ -74,21 +74,24 @@ D2UpdateMgr::checkFinishedTransactions() {
     // for finished transactions.
     // At the moment all we do is remove them from the list. This is likely
     // to expand as DHCP_DDNS matures.
+    // NOTE: One must use postfix increments of the iterator on the calls
+    // to erase.  This replaces the old iterator which becomes invalid by the
+    // erase with a the next valid iterator.  Prefix incrementing will not
+    // work. 
     TransactionList::iterator it = transaction_list_.begin();
     while (it != transaction_list_.end()) {
         NameChangeTransactionPtr trans = (*it).second;
         switch (trans->getNcrStatus())  {
         case dhcp_ddns::ST_COMPLETED:
-            transaction_list_.erase(it);
+            transaction_list_.erase(it++);
             break;
         case dhcp_ddns::ST_FAILED:
-            transaction_list_.erase(it);
+            transaction_list_.erase(it++);
             break;
         default:
+            ++it;
             break;
         }
-
-        ++it;
     }
 }
 



More information about the bind10-changes mailing list