]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2387] Add comments on use of auto_ptr
authorMukund Sivaraman <muks@isc.org>
Tue, 9 Apr 2013 05:31:47 +0000 (11:01 +0530)
committerMukund Sivaraman <muks@isc.org>
Tue, 9 Apr 2013 05:31:47 +0000 (11:01 +0530)
src/lib/dns/rdata/generic/dnskey_48.cc
src/lib/dns/rdata/generic/nsec3_50.cc
src/lib/dns/rdata/generic/nsec3param_51.cc

index 44dc8c53efb96b1b28ce8e233ea2f0944d9bb3dc..d3a923a015cfdca1378297fb96014ca50343ad10 100644 (file)
@@ -72,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 {
index 11a898932f49bdeff7d294cf2d6239db7b0318ec..fd8f78d2da4007ea568398e28f6b5abb0a12bca0 100644 (file)
@@ -87,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 {
index ca03bf37a2177dfd89d5d8986267daebec3db6ba..494746da5abf9e1b969df1ab807d8d0e97a14cd1 100644 (file)
@@ -65,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 {