mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
fixed memory leak
This commit is contained in:
@@ -29,6 +29,7 @@ namespace ntcp
|
|||||||
NTCPSession::~NTCPSession ()
|
NTCPSession::~NTCPSession ()
|
||||||
{
|
{
|
||||||
delete m_DHKeysPair;
|
delete m_DHKeysPair;
|
||||||
|
delete m_NextMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NTCPSession::CreateAESKey (uint8_t * pubKey, uint8_t * aesKey)
|
void NTCPSession::CreateAESKey (uint8_t * pubKey, uint8_t * aesKey)
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ namespace i2p
|
|||||||
{
|
{
|
||||||
i2p::data::DHKeysPair * pair = new i2p::data::DHKeysPair ();
|
i2p::data::DHKeysPair * pair = new i2p::data::DHKeysPair ();
|
||||||
i2p::data::CreateRandomDHKeysPair (pair);
|
i2p::data::CreateRandomDHKeysPair (pair);
|
||||||
|
std::unique_lock<std::mutex> l(m_AcquiredMutex);
|
||||||
m_Queue.push (pair);
|
m_Queue.push (pair);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -61,6 +62,7 @@ namespace i2p
|
|||||||
{
|
{
|
||||||
if (!m_Queue.empty ())
|
if (!m_Queue.empty ())
|
||||||
{
|
{
|
||||||
|
std::unique_lock<std::mutex> l(m_AcquiredMutex);
|
||||||
auto pair = m_Queue.front ();
|
auto pair = m_Queue.front ();
|
||||||
m_Queue.pop ();
|
m_Queue.pop ();
|
||||||
m_Acquired.notify_one ();
|
m_Acquired.notify_one ();
|
||||||
|
|||||||
Reference in New Issue
Block a user