Commit c0a4d644 authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[3080] A few additional minor review corrections.

PgSqlLeaseMgr::openDatabase now sets conn_ to NULL after calling PQfinish.
PgSqlLeaseMgr constructor, moved member inits to the initializer list
Fixed exception text.
parent 08def087
......@@ -280,9 +280,9 @@ public:
if (!lease_->hwaddr_.empty()) {
if (lease->hwaddr_.size() > HWAddr::MAX_HWADDR_LEN) {
isc_throw(DbOperationError,
"Attempted to store Hardware address longer ("
"Hardware address length : "
<< lease->hwaddr_.size()
<< " than allowed maximum of "
<< " exceeds maximum allowed of: "
<< HWAddr::MAX_HWADDR_LEN);
}
......@@ -569,13 +569,10 @@ private:
};
PgSqlLeaseMgr::PgSqlLeaseMgr(const LeaseMgr::ParameterMap& parameters)
: LeaseMgr(parameters) {
conn_ = NULL;
: LeaseMgr(parameters), exchange4_(new PgSqlLease4Exchange()),
exchange6_(new PgSqlLease6Exchange()), conn_(NULL) {
openDatabase();
prepareStatements();
exchange4_.reset(new PgSqlLease4Exchange());
exchange6_.reset(new PgSqlLease6Exchange());
}
PgSqlLeaseMgr::~PgSqlLeaseMgr() {
......@@ -590,6 +587,7 @@ PgSqlLeaseMgr::~PgSqlLeaseMgr() {
PQclear(r);
PQfinish(conn_);
conn_ = NULL;
}
}
......@@ -665,6 +663,7 @@ PgSqlLeaseMgr::openDatabase() {
// to release it, but grab the error message first.
std::string error_message = PQerrorMessage(conn_);
PQfinish(conn_);
conn_ = NULL;
isc_throw(DbOpenError, error_message);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment