[svn] commit: r715 - /branches/parkinglot/src/lib/auth/cpp/data_source.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Feb 3 19:03:58 UTC 2010


Author: jinmei
Date: Wed Feb  3 19:03:58 2010
New Revision: 715

Log:
made sure data (RRsetList) is initialized in each iteration of the while loop
in runQuery().

the bug is a perfect example of why we should define variables as locally as
possible (and more preferably why we should avoid using variables maintaining
states as much as possible in the first place)

Modified:
    branches/parkinglot/src/lib/auth/cpp/data_source.cc

Modified: branches/parkinglot/src/lib/auth/cpp/data_source.cc
==============================================================================
--- branches/parkinglot/src/lib/auth/cpp/data_source.cc (original)
+++ branches/parkinglot/src/lib/auth/cpp/data_source.cc Wed Feb  3 19:03:58 2010
@@ -13,11 +13,11 @@
 DSResult
 DataSrc::runQuery(Query q) {
     DSResult result;
-    RRsetList data, sigs;
     Name container(".");
     Message& m = q.message();
 
     while (!q.tasks().empty()) {
+        RRsetList data, sigs;
         bool found = false;
         QueryTaskPtr task = q.tasks().front();
         q.tasks().pop();
@@ -40,6 +40,7 @@
 
         switch (result) {
             case SUCCESS:
+                // XXX: what if 'data' contains more than one RRset?
                 m.addRRset(task->section, data[0]);
                 if (q.wantDnssec() && sigs.size() == 1) {
                     m.addRRset(Section(task->section), sigs[0]);




More information about the bind10-changes mailing list