From: Mukund Sivaraman Date: Tue, 9 Apr 2013 05:31:47 +0000 (+0530) Subject: [2387] Add comments on use of auto_ptr X-Git-Tag: bind10-1.2.0beta1-release~481^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=82fc64bf97eb7d50e22edcac28cefe0b93b9a7ff;p=thirdparty%2Fkea.git [2387] Add comments on use of auto_ptr --- diff --git a/src/lib/dns/rdata/generic/dnskey_48.cc b/src/lib/dns/rdata/generic/dnskey_48.cc index 44dc8c53ef..d3a923a015 100644 --- a/src/lib/dns/rdata/generic/dnskey_48.cc +++ b/src/lib/dns/rdata/generic/dnskey_48.cc @@ -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 impl_ptr(NULL); try { diff --git a/src/lib/dns/rdata/generic/nsec3_50.cc b/src/lib/dns/rdata/generic/nsec3_50.cc index 11a898932f..fd8f78d2da 100644 --- a/src/lib/dns/rdata/generic/nsec3_50.cc +++ b/src/lib/dns/rdata/generic/nsec3_50.cc @@ -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 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 ca03bf37a2..494746da5a 100644 --- a/src/lib/dns/rdata/generic/nsec3param_51.cc +++ b/src/lib/dns/rdata/generic/nsec3param_51.cc @@ -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 impl_ptr(NULL); try {