prevent double free

This commit is contained in:
Jeff Becker 2016-09-03 16:29:50 -04:00
parent d336d920e8
commit 82f46464f3
No known key found for this signature in database
GPG key ID: AB950234D6EA286B
2 changed files with 9 additions and 3 deletions

View file

@ -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;