mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
prevent double free
This commit is contained in:
parent
d336d920e8
commit
82f46464f3
@ -205,12 +205,12 @@ namespace datagram
|
||||
if(lease)
|
||||
{
|
||||
if(tunnel)
|
||||
return DatagramSession::Info{new i2p::data::IdentHash(lease->tunnelGateway.data()), new i2p::data::IdentHash(tunnel->GetEndpointIdentHash().data()), m_LastUse, m_LastSuccess};
|
||||
return DatagramSession::Info{lease->tunnelGateway, tunnel->GetEndpointIdentHash(), m_LastUse, m_LastSuccess};
|
||||
else
|
||||
return DatagramSession::Info{new i2p::data::IdentHash(lease->tunnelGateway.data()), nullptr, m_LastUse, m_LastSuccess};
|
||||
return DatagramSession::Info{lease->tunnelGateway, nullptr, m_LastUse, m_LastSuccess};
|
||||
}
|
||||
else if(tunnel)
|
||||
return DatagramSession::Info{nullptr, new i2p::data::IdentHash(tunnel->GetEndpointIdentHash().data()), m_LastUse, m_LastSuccess};
|
||||
return DatagramSession::Info{nullptr, tunnel->GetEndpointIdentHash(), m_LastUse, m_LastSuccess};
|
||||
else
|
||||
return DatagramSession::Info{nullptr, nullptr, m_LastUse, m_LastSuccess};
|
||||
}
|
||||
|
@ -52,6 +52,12 @@ namespace datagram
|
||||
const i2p::data::IdentHash * OBEP;
|
||||
const uint64_t activity;
|
||||
const uint64_t success;
|
||||
Info() : IBGW(nullptr), OBEP(nullptr), activity(0), success(0) {}
|
||||
Info(const i2p::data::IdentHash & ibgw, const i2p::data::IdentHash & obep, const uint64_t a, const uint64_t s) :
|
||||
IBGW(new i2p::data::IdentHash(ibgw.data())),
|
||||
OBEP(new i2p::data::IdentHash(obep.data())),
|
||||
activity(a),
|
||||
success(s) {}
|
||||
~Info()
|
||||
{
|
||||
if(IBGW) delete IBGW;
|
||||
|
Loading…
Reference in New Issue
Block a user