]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3232] Initialize all values in Lease6 in the default constructor.
authorMarcin Siodelski <marcin@isc.org>
Wed, 12 Mar 2014 17:35:35 +0000 (18:35 +0100)
committerMarcin Siodelski <marcin@isc.org>
Wed, 12 Mar 2014 17:35:35 +0000 (18:35 +0100)
Failing to initialize all values causes valgrind errors.

src/lib/dhcpsrv/lease.cc
src/lib/dhcpsrv/lease.h

index 7bc71f94d87eab769ddff1f8a386874cd4fc66f5..159cda533b37292c94836a6165c601fced39fb50 100644 (file)
@@ -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"
index c76714276181a69286a0c68bb8c3777893094992..a8f4527963495a1b5c9832d29c27837966d6ea90 100644 (file)
@@ -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.
     ///