BIND 10 trac2387, updated. 82fc64bf97eb7d50e22edcac28cefe0b93b9a7ff [2387] Add comments on use of auto_ptr

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Apr 9 05:33:46 UTC 2013


The branch, trac2387 has been updated
       via  82fc64bf97eb7d50e22edcac28cefe0b93b9a7ff (commit)
       via  e8b5540d1dbc1e80eb98d15e1dab3b9c26fe7ccb (commit)
       via  3f9a24a0ddf821e8e16b2c99d2e7335f2c40fa09 (commit)
       via  65f68f7b9235307f8af029b37ebc7c2a309ed7e9 (commit)
      from  0e61367a4241444a7465b25ee461adb7e829acc2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 82fc64bf97eb7d50e22edcac28cefe0b93b9a7ff
Author: Mukund Sivaraman <muks at isc.org>
Date:   Tue Apr 9 11:01:47 2013 +0530

    [2387] Add comments on use of auto_ptr

commit e8b5540d1dbc1e80eb98d15e1dab3b9c26fe7ccb
Author: Mukund Sivaraman <muks at isc.org>
Date:   Tue Apr 9 10:57:15 2013 +0530

    [2387] Add includes
    
    These are not strictly necessary, as other headers include <memory>.

commit 3f9a24a0ddf821e8e16b2c99d2e7335f2c40fa09
Author: Mukund Sivaraman <muks at isc.org>
Date:   Tue Apr 9 10:53:12 2013 +0530

    [2387] Remove default data from wiredata .spec files

commit 65f68f7b9235307f8af029b37ebc7c2a309ed7e9
Author: Mukund Sivaraman <muks at isc.org>
Date:   Tue Apr 9 10:52:14 2013 +0530

    [2387] Add some assertions anyway

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dns/rdata/generic/detail/nsec_bitmap.cc    |    1 +
 src/lib/dns/rdata/generic/dnskey_48.cc             |    6 ++++++
 src/lib/dns/rdata/generic/nsec3_50.cc              |    5 +++++
 src/lib/dns/rdata/generic/nsec3param_51.cc         |    4 ++++
 .../rdata_dnskey_empty_keydata_fromWire.spec       |    3 ---
 .../dns/tests/testdata/rdata_dnskey_fromWire.spec  |    3 ---
 6 files changed, 16 insertions(+), 6 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/rdata/generic/detail/nsec_bitmap.cc b/src/lib/dns/rdata/generic/detail/nsec_bitmap.cc
index 5deaa69..4c1c6dd 100644
--- a/src/lib/dns/rdata/generic/detail/nsec_bitmap.cc
+++ b/src/lib/dns/rdata/generic/detail/nsec_bitmap.cc
@@ -96,6 +96,7 @@ buildBitmapsFromLexer(const char* const rrtype_name,
         }
 
         // token is now assured to be of type STRING.
+        assert(token.getType() == MasterToken::STRING);
 
         have_rrtypes = true;
         token.getString(type_str);
diff --git a/src/lib/dns/rdata/generic/dnskey_48.cc b/src/lib/dns/rdata/generic/dnskey_48.cc
index ec0d820..d3a923a 100644
--- a/src/lib/dns/rdata/generic/dnskey_48.cc
+++ b/src/lib/dns/rdata/generic/dnskey_48.cc
@@ -27,6 +27,8 @@
 #include <dns/rdata.h>
 #include <dns/rdataclass.h>
 
+#include <memory>
+
 #include <stdio.h>
 #include <time.h>
 
@@ -70,6 +72,9 @@ struct DNSKEYImpl {
 DNSKEY::DNSKEY(const std::string& dnskey_str) :
     impl_(NULL)
 {
+    // We use auto_ptr here because if there is an exception in this
+    // constructor, the destructor is not called and there could be a
+    // leak of the DNSKEYImpl that constructFromLexer() returns.
     std::auto_ptr<DNSKEYImpl> impl_ptr(NULL);
 
     try {
@@ -173,6 +178,7 @@ DNSKEY::constructFromLexer(MasterLexer& lexer) {
         }
 
         // token is now assured to be of type STRING.
+        assert(token.getType() == MasterToken::STRING);
 
         token.getString(keydata_substr);
         keydata_str.append(keydata_substr);
diff --git a/src/lib/dns/rdata/generic/nsec3_50.cc b/src/lib/dns/rdata/generic/nsec3_50.cc
index 1d60dbd..fd8f78d 100644
--- a/src/lib/dns/rdata/generic/nsec3_50.cc
+++ b/src/lib/dns/rdata/generic/nsec3_50.cc
@@ -35,6 +35,8 @@
 #include <dns/rdata/generic/detail/nsec_bitmap.h>
 #include <dns/rdata/generic/detail/nsec3param_common.h>
 
+#include <memory>
+
 #include <stdio.h>
 #include <time.h>
 
@@ -85,6 +87,9 @@ struct NSEC3Impl {
 NSEC3::NSEC3(const std::string& nsec3_str) :
     impl_(NULL)
 {
+    // We use auto_ptr here because if there is an exception in this
+    // constructor, the destructor is not called and there could be a
+    // leak of the NSEC3Impl that constructFromLexer() returns.
     std::auto_ptr<NSEC3Impl> impl_ptr(NULL);
 
     try {
diff --git a/src/lib/dns/rdata/generic/nsec3param_51.cc b/src/lib/dns/rdata/generic/nsec3param_51.cc
index 2ad46ae..494746d 100644
--- a/src/lib/dns/rdata/generic/nsec3param_51.cc
+++ b/src/lib/dns/rdata/generic/nsec3param_51.cc
@@ -22,6 +22,7 @@
 
 #include <boost/lexical_cast.hpp>
 
+#include <memory>
 #include <string>
 #include <sstream>
 #include <vector>
@@ -64,6 +65,9 @@ struct NSEC3PARAMImpl {
 NSEC3PARAM::NSEC3PARAM(const std::string& nsec3param_str) :
     impl_(NULL)
 {
+    // We use auto_ptr here because if there is an exception in this
+    // constructor, the destructor is not called and there could be a
+    // leak of the NSEC3PARAMImpl that constructFromLexer() returns.
     std::auto_ptr<NSEC3PARAMImpl> impl_ptr(NULL);
 
     try {
diff --git a/src/lib/dns/tests/testdata/rdata_dnskey_empty_keydata_fromWire.spec b/src/lib/dns/tests/testdata/rdata_dnskey_empty_keydata_fromWire.spec
index 6fe4eac..b65271d 100644
--- a/src/lib/dns/tests/testdata/rdata_dnskey_empty_keydata_fromWire.spec
+++ b/src/lib/dns/tests/testdata/rdata_dnskey_empty_keydata_fromWire.spec
@@ -4,7 +4,4 @@
 sections: dnskey
 
 [dnskey]
-flags: 257
-protocol: 3
-algorithm: 5
 digest:
diff --git a/src/lib/dns/tests/testdata/rdata_dnskey_fromWire.spec b/src/lib/dns/tests/testdata/rdata_dnskey_fromWire.spec
index 623b060..87e66db 100644
--- a/src/lib/dns/tests/testdata/rdata_dnskey_fromWire.spec
+++ b/src/lib/dns/tests/testdata/rdata_dnskey_fromWire.spec
@@ -4,7 +4,4 @@
 sections: dnskey
 
 [dnskey]
-flags: 257
-protocol: 3
-algorithm: 5
 digest: BEAAAAOhHQDBrhQbtphgq2wQUpEQ5t4DtUHxoMVFu2hWLDMvoOMRXjGrhhCeFvAZih7yJHf8ZGfW6hd38hXG/xylYCO6Krpbdojwx8YMXLA5/kA+u50WIL8ZR1R6KTbsYVMf/Qx5RiNbPClw+vT+U8eXEJmO20jIS1ULgqy347cBB1zMnnz/4LJpA0da9CbKj3A254T515sNIMcwsB8/2+2E63/zZrQzBkj0BrN/9Bexjpiks3jRhZatEsXn3dTy47R09Uix5WcJt+xzqZ7+ysyLKOOedS39Z7SDmsn2eA0FKtQpwA6LXeG2w+jxmw3oA8lVUgEf/rzeC/bByBNsO70aEFTd



More information about the bind10-changes mailing list