summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcin Siodelski <marcin@isc.org>2014-03-12 18:35:35 +0100
committerMarcin Siodelski <marcin@isc.org>2014-03-12 18:35:35 +0100
commit8ae73d0c674b4bd641d1323c447c19f9f255be0c (patch)
treeda72a85a383c009ef35126b9f128be4a714ea6f8
parent[3232] Merge branch 'master' into trac3232 (diff)
downloadkea-8ae73d0c674b4bd641d1323c447c19f9f255be0c.tar.xz
kea-8ae73d0c674b4bd641d1323c447c19f9f255be0c.zip
[3232] Initialize all values in Lease6 in the default constructor.
Failing to initialize all values causes valgrind errors.
-rw-r--r--src/lib/dhcpsrv/lease.cc8
-rw-r--r--src/lib/dhcpsrv/lease.h5
2 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/dhcpsrv/lease.cc b/src/lib/dhcpsrv/lease.cc
index 7bc71f94d8..159cda533b 100644
--- a/src/lib/dhcpsrv/lease.cc
+++ b/src/lib/dhcpsrv/lease.cc
@@ -166,6 +166,12 @@ Lease6::Lease6(Type type, const isc::asiolink::IOAddress& addr,
cltt_ = time(NULL);
}
+Lease6::Lease6()
+ : Lease(isc::asiolink::IOAddress("::"), 0, 0, 0, 0, 0, false, false, ""),
+ type_(TYPE_NA), prefixlen_(0), iaid_(0), duid_(DuidPtr()),
+ preferred_lft_(0) {
+}
+
const std::vector<uint8_t>&
Lease6::getDuidVector() const {
if (!duid_) {
@@ -180,7 +186,7 @@ std::string
Lease6::toText() const {
ostringstream stream;
- stream << "Type: " << typeToText(type_) << "("
+ stream << "Type: " << typeToText(type_) << "("
<< static_cast<int>(type_) << ") ";
stream << "Address: " << addr_ << "\n"
<< "Prefix length: " << static_cast<int>(prefixlen_) << "\n"
diff --git a/src/lib/dhcpsrv/lease.h b/src/lib/dhcpsrv/lease.h
index c767142761..a8f4527963 100644
--- a/src/lib/dhcpsrv/lease.h
+++ b/src/lib/dhcpsrv/lease.h
@@ -348,10 +348,7 @@ struct Lease6 : public Lease {
/// @brief Constructor
///
/// Initialize fields that don't have a default constructor.
- Lease6() : Lease(isc::asiolink::IOAddress("::"), 0, 0, 0, 0, 0,
- false, false, ""),
- type_(TYPE_NA) {
- }
+ Lease6();
/// @brief Returns a reference to a vector representing a DUID.
///