lic: Fixed crash in License destruction (issue #698)

This commit is contained in:
Eberhard Graether
2019-05-27 12:22:22 +02:00
parent 6376b4bca7
commit 82fcd4f673
2 changed files with 4 additions and 10 deletions
+4 -3
View File
@@ -43,7 +43,6 @@ std::string removeCaption(const std::string& line, const std::string& caption)
}
License::License()
: m_rng(std::make_unique<Botan::AutoSeeded_RNG>())
{
}
@@ -335,12 +334,14 @@ std::string License::getLicenseString() const
std::string License::generateHash(const std::string& str) const
{
if (m_rng == NULL || str.size() <= 0)
if (str.size() <= 0)
{
return "";
}
return Botan::generate_passhash9(str, *(m_rng.get()));
Botan::AutoSeeded_RNG rng;
return Botan::generate_passhash9(str, rng);
}
bool License::checkHash(const std::string& str, const std::string& hash)
-7
View File
@@ -5,11 +5,6 @@
#include <string>
#include <vector>
namespace Botan
{
class AutoSeeded_RNG;
}
namespace LicenseConstants
{
const char BEGIN_LICENSE[] = "-----BEGIN LICENSE-----";
@@ -85,8 +80,6 @@ private:
bool loadFromLines(const std::vector<std::string>& lines);
bool loadFromLinesOld(const std::vector<std::string>& lines);
std::unique_ptr<Botan::AutoSeeded_RNG> m_rng;
std::string m_user;
std::string m_type;
size_t m_numberOfUsers = 0;