Browse Source

made the AuthSrv constructor exception-safe

git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1268 e5f2f494-b856-4b98-b285-d166d9295462
JINMEI Tatuya 15 years ago
parent
commit
17910faa10
1 changed files with 7 additions and 9 deletions
  1. 7 9
      src/bin/auth/auth_srv.cc

+ 7 - 9
src/bin/auth/auth_srv.cc

@@ -71,20 +71,18 @@ public:
 };
 
 AuthSrvImpl::AuthSrvImpl() {
-}
-
-AuthSrv::AuthSrv() {
-    impl_ = new AuthSrvImpl;
-    // set empty (sqlite) data source, once ccsession is up
+    // cur_datasrc_ is automatically initialized by the default constructor,
+    // effectively being an empty (sqlite) data source.  once ccsession is up
     // the datasource will be set by the configuration setting
     // (or the default one if none is set)
-    impl_->cur_datasrc_ = ConstDataSrcPtr();
+
     // add static data source
-    impl_->data_sources_.addDataSrc(ConstDataSrcPtr(new StaticDataSrc));
+    data_sources_.addDataSrc(ConstDataSrcPtr(new StaticDataSrc));
 }
 
-AuthSrv::~AuthSrv()
-{
+AuthSrv::AuthSrv() : impl_(new AuthSrvImpl) {}
+
+AuthSrv::~AuthSrv() {
     delete impl_;
 }