diff --git a/src/cpp/Crypto/AuthenticatedEncryption.h b/src/cpp/Crypto/AuthenticatedEncryption.h index 154286883..a19e0f856 100644 --- a/src/cpp/Crypto/AuthenticatedEncryption.h +++ b/src/cpp/Crypto/AuthenticatedEncryption.h @@ -4,6 +4,9 @@ #include "../SingletonManager/MemoryManager.h" #include "../lib/AutoPtrContainer.h" + +#include "Poco/AutoPtr.h" + #include #include @@ -45,6 +48,9 @@ public: inline KeyHashed getKeyHashed() const { std::shared_lock _lock(mWorkingMutex); return mEncryptionKeyHash; } inline bool operator == (const Poco::AutoPtr& b) const { + return isTheSame(b); + } + inline bool isTheSame(const Poco::AutoPtr& b) const { std::shared_lock _lock(mWorkingMutex); if (b.isNull()) return false; return mEncryptionKeyHash == b->getKeyHashed(); diff --git a/src/cpp/Crypto/Passphrase.cpp b/src/cpp/Crypto/Passphrase.cpp index 421cca11b..d6403ca6e 100644 --- a/src/cpp/Crypto/Passphrase.cpp +++ b/src/cpp/Crypto/Passphrase.cpp @@ -352,10 +352,9 @@ const Mnemonic* Passphrase::detectMnemonic(const std::string& passphrase, const } if (existAll) { if (keyPair) { - auto test_passphrase = new Passphrase(passphrase, &m); + Poco::AutoPtr test_passphrase = new Passphrase(passphrase, &m); test_passphrase->createWordIndices(); auto key_pair = KeyPairEd25519::create(test_passphrase); - delete test_passphrase; if (key_pair) { if (*key_pair != *keyPair) { delete key_pair;