Fix cryptography memory leaks :P
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
|
||||
namespace Components
|
||||
{
|
||||
Utils::Cryptography::ECDSA::Key Node::SignatureKey;
|
||||
|
||||
std::vector<Node::NodeEntry> Node::Nodes;
|
||||
std::vector<Node::DediEntry> Node::Dedis;
|
||||
|
||||
@ -396,6 +398,9 @@ namespace Components
|
||||
// ZoneBuilder doesn't require node stuff
|
||||
if (ZoneBuilder::IsEnabled()) return;
|
||||
|
||||
// Generate our ECDSA key
|
||||
Node::SignatureKey = Utils::Cryptography::ECDSA::GenerateKey(512);
|
||||
|
||||
Dvar::OnInit([] ()
|
||||
{
|
||||
Node::Dedis.clear();
|
||||
@ -570,6 +575,8 @@ namespace Components
|
||||
|
||||
Node::~Node()
|
||||
{
|
||||
Node::SignatureKey.Free();
|
||||
|
||||
Node::StoreNodes(true);
|
||||
Node::Nodes.clear();
|
||||
Node::Dedis.clear();
|
||||
|
@ -44,6 +44,7 @@ namespace Components
|
||||
struct NodeEntry
|
||||
{
|
||||
Network::Address address;
|
||||
Utils::Cryptography::ECDSA::Key publicKey;
|
||||
EntryState state;
|
||||
int lastTime; // Last time we heard anything from the server itself
|
||||
int lastHeartbeat; // Last time we got a heartbeat from it
|
||||
@ -84,6 +85,8 @@ namespace Components
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
static Utils::Cryptography::ECDSA::Key SignatureKey;
|
||||
|
||||
static std::vector<NodeEntry> Nodes;
|
||||
static std::vector<DediEntry> Dedis;
|
||||
|
||||
|
Reference in New Issue
Block a user