From: Michal 'vorner' Vaner Date: Mon, 10 Dec 2012 12:36:08 +0000 (+0100) Subject: [2377] Make the construction exception safe X-Git-Tag: bind10-1.0.0-beta-release~24^2~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f77ed1ab54bc60e08292d58fbc4cfc635cd1ef42;p=thirdparty%2Fkea.git [2377] Make the construction exception safe --- diff --git a/src/lib/dns/master_loader.cc b/src/lib/dns/master_loader.cc index bc1b4d1231..7b136e8b8b 100644 --- a/src/lib/dns/master_loader.cc +++ b/src/lib/dns/master_loader.cc @@ -21,8 +21,10 @@ #include #include +#include using std::string; +using std::auto_ptr; namespace isc { namespace dns { @@ -236,9 +238,12 @@ MasterLoader::MasterLoader(std::istream& stream, if (add_callback.empty()) { isc_throw(isc::InvalidParameter, "Empty add RR callback"); } - impl_ = new MasterLoaderImpl("", zone_origin, zone_class, callbacks, - add_callback, options); - impl_->pushStreamSource(stream); + auto_ptr impl(new MasterLoaderImpl("", zone_origin, + zone_class, callbacks, + add_callback, + options)); + impl->pushStreamSource(stream); + impl_ = impl.release(); } MasterLoader::~MasterLoader() {