Browse Source

[trac1084] Reorder statements in MemoryZone::add

Only log details of the zone being added after input validation,
when it is known the the zone pointer is non-null.  (Validation
detects null pointers and throws an exception.)
Stephen Morris 14 years ago
parent
commit
4191945aad
1 changed files with 5 additions and 2 deletions
  1. 5 2
      src/lib/datasrc/memory_datasrc.cc

+ 5 - 2
src/lib/datasrc/memory_datasrc.cc

@@ -225,10 +225,13 @@ struct MemoryZone::MemoryZoneImpl {
      */
     // Implementation of MemoryZone::add
     result::Result add(const ConstRRsetPtr& rrset, DomainTree* domains) {
+        // Sanitize input.  This will cause an exception to be thrown
+        // if the input RRset is empty.
+        addValidation(rrset);
+
+        // OK, can add the RRset.
         LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_ADD_RRSET).
             arg(rrset->getName()).arg(rrset->getType()).arg(origin_);
-        // Sanitize input
-        addValidation(rrset);
 
         // Add wildcards possibly contained in the owner name to the domain
         // tree.