security+tests: Fix small bugs with uninitialized and leaked memory
Change-Id: I525ac8d284783ffff08e31dc7fe2a892bfc78307
diff --git a/src/security/command-interest-signer.cpp b/src/security/command-interest-signer.cpp
index 1dfe1ce..0d2f82f 100644
--- a/src/security/command-interest-signer.cpp
+++ b/src/security/command-interest-signer.cpp
@@ -25,6 +25,11 @@
namespace ndn {
namespace security {
+CommandInterestPreparer::CommandInterestPreparer()
+ : m_lastUsedTimestamp(0)
+{
+}
+
Name
CommandInterestPreparer::prepareCommandInterestName(Name name)
{
diff --git a/src/security/command-interest-signer.hpp b/src/security/command-interest-signer.hpp
index 7033b3f..6c5e2ce 100644
--- a/src/security/command-interest-signer.hpp
+++ b/src/security/command-interest-signer.hpp
@@ -41,6 +41,8 @@
class CommandInterestPreparer : noncopyable
{
public:
+ CommandInterestPreparer();
+
/**
* @brief Prepare name of the CommandInterest
*
diff --git a/tests/unit-tests/util/in-memory-storage-common.t.cpp b/tests/unit-tests/util/in-memory-storage-common.t.cpp
index 802b2f7..a4a992b 100644
--- a/tests/unit-tests/util/in-memory-storage-common.t.cpp
+++ b/tests/unit-tests/util/in-memory-storage-common.t.cpp
@@ -277,12 +277,12 @@
ConstBufferPtr digest1 = crypto::computeSha256Digest(data->wireEncode().wire(), data->wireEncode().size());
BOOST_CHECK_EQUAL(digest1->size(), 32);
- InMemoryStorageEntry* entry = new InMemoryStorageEntry();
- entry->setData(*data);
+ InMemoryStorageEntry entry;
+ entry.setData(*data);
BOOST_CHECK_EQUAL_COLLECTIONS(digest1->begin(), digest1->end(),
- entry->getFullName()[-1].value_begin(),
- entry->getFullName()[-1].value_end());
+ entry.getFullName()[-1].value_begin(),
+ entry.getFullName()[-1].value_end());
}
BOOST_AUTO_TEST_CASE_TEMPLATE(Iterator, T, InMemoryStorages)