]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2108] Test for segment leaks due to allocation failures
authorMukund Sivaraman <muks@isc.org>
Mon, 10 Sep 2012 07:45:30 +0000 (13:15 +0530)
committerMukund Sivaraman <muks@isc.org>
Mon, 10 Sep 2012 07:45:30 +0000 (13:15 +0530)
src/lib/datasrc/memory/tests/memory_client_unittest.cc

index 0290a28cb4ed113d2875f033b75c65b452bde73e..8a7f19ebfa79c7420f9d8e1228b7e0500f33150d 100644 (file)
@@ -211,6 +211,18 @@ TEST_F(MemoryClientTest, loadFromIterator) {
     EXPECT_THROW(iterator->getNextRRset(), isc::Unexpected);
 }
 
+TEST_F(MemoryClientTest, loadMemoryAllocationFailures) {
+    // Just to check that things get cleaned up
+
+    for (int i = 1; i < 16; i++) {
+        mem_sgmt_.setThrowCount(i);
+        EXPECT_THROW(client_->load(Name("example.org"),
+                                   TEST_DATA_DIR "/example.org.zone"),
+                     std::bad_alloc);
+    }
+    // Teardown checks for memory segment leaks
+}
+
 TEST_F(MemoryClientTest, loadNSEC3Signed) {
     client_->load(Name("example.org"),
                   TEST_DATA_DIR "/example.org-nsec3-signed.zone");