Browse Source

[2471] make sure rdata iterator is valid in DNAME proc for sufficiently long

otherwise it could result in using a freed object if the RRset comes from
the built in in-memory data source.  This change makes the test in the
previous commit pass.
JINMEI Tatuya 12 years ago
parent
commit
931c0c2e32
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/bin/auth/query.cc

+ 2 - 2
src/bin/auth/query.cc

@@ -410,9 +410,9 @@ Query::process(datasrc::ClientList& client_list,
              */
             assert(db_context->rrset->getRdataCount() > 0);
             // Get the data of DNAME
+            RdataIteratorPtr rit = db_context->rrset->getRdataIterator();
             const rdata::generic::DNAME& dname(
-                dynamic_cast<const rdata::generic::DNAME&>(
-                db_context->rrset->getRdataIterator()->getCurrent()));
+                dynamic_cast<const rdata::generic::DNAME&>(rit->getCurrent()));
             // The yet unmatched prefix dname
             const Name prefix(qname_->split(0, qname_->getLabelCount() -
                 db_context->rrset->getName().getLabelCount()));