From 73ef5e29c251ed87fb21fd444c1e32bd773605ce Mon Sep 17 00:00:00 2001 From: orignal Date: Sat, 5 Jul 2014 08:33:08 -0400 Subject: [PATCH] fixed memory leak --- TunnelEndpoint.cpp | 6 ++++++ TunnelEndpoint.h | 1 + 2 files changed, 7 insertions(+) diff --git a/TunnelEndpoint.cpp b/TunnelEndpoint.cpp index cdc9a975..d9189fe8 100644 --- a/TunnelEndpoint.cpp +++ b/TunnelEndpoint.cpp @@ -9,6 +9,12 @@ namespace i2p { namespace tunnel { + TunnelEndpoint::~TunnelEndpoint () + { + for (auto it: m_IncompleteMessages) + i2p::DeleteI2NPMessage (it.second.data); + } + void TunnelEndpoint::HandleDecryptedTunnelDataMsg (I2NPMessage * msg) { m_NumReceivedBytes += TUNNEL_DATA_MSG_SIZE; diff --git a/TunnelEndpoint.h b/TunnelEndpoint.h index 4621088d..749c3e3f 100644 --- a/TunnelEndpoint.h +++ b/TunnelEndpoint.h @@ -21,6 +21,7 @@ namespace tunnel public: TunnelEndpoint (): m_NumReceivedBytes (0) {}; + ~TunnelEndpoint (); size_t GetNumReceivedBytes () const { return m_NumReceivedBytes; }; void HandleDecryptedTunnelDataMsg (I2NPMessage * msg);