]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2836] The updater is never NULL in destructor
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 13 May 2013 12:45:17 +0000 (14:45 +0200)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 13 May 2013 12:45:17 +0000 (14:45 +0200)
So remove the condition to check it. Keep an assert there, just in case
there was a reason originally, so we know about it.

src/lib/datasrc/tests/memory/zone_data_updater_unittest.cc

index 7bb856b0271408161995f641b2cc63d21f14f6e0..3a9d4a66424afa271e32fec6d4ce7dd4ecad24a2 100644 (file)
@@ -81,12 +81,11 @@ protected:
     }
 
     ~ZoneDataUpdaterTest() {
-        if (updater_) {
-            ZoneData::destroy(*mem_sgmt_, getZoneData(), zclass_);
-            // Release the updater, so it frees all memory inside the segment too
-            updater_.reset();
-            mem_sgmt_->clearNamedAddress("Test zone data");
-        }
+        assert(updater_);
+        ZoneData::destroy(*mem_sgmt_, getZoneData(), zclass_);
+        // Release the updater, so it frees all memory inside the segment too
+        updater_.reset();
+        mem_sgmt_->clearNamedAddress("Test zone data");
         if (!mem_sgmt_->allMemoryDeallocated()) {
             ADD_FAILURE() << "Memory leak detected";
         }