2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 05:55:28 +00:00

[2377] Make the construction exception safe

This commit is contained in:
Michal 'vorner' Vaner
2012-12-10 13:36:08 +01:00
parent 9e8813efff
commit f77ed1ab54

View File

@@ -21,8 +21,10 @@
#include <dns/rdata.h>
#include <string>
#include <memory>
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<MasterLoaderImpl> impl(new MasterLoaderImpl("", zone_origin,
zone_class, callbacks,
add_callback,
options));
impl->pushStreamSource(stream);
impl_ = impl.release();
}
MasterLoader::~MasterLoader() {