Skip to content

Commit 624fc08

Browse files
authored
Fix Botan leaking memory if connection force closed (#300)
1 parent f754e1c commit 624fc08

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

trantor/net/inner/TcpConnectionImpl.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,9 @@ void TcpConnectionImpl::forceClose()
439439
{
440440
thisPtr->status_ = ConnStatus::Disconnecting;
441441
thisPtr->handleClose();
442+
443+
if (thisPtr->tlsProviderPtr_)
444+
thisPtr->tlsProviderPtr_->close();
442445
}
443446
});
444447
}

trantor/net/inner/tlsprovider/BotanTLSProvider.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,10 @@ struct BotanTLSProvider : public TLSProvider,
229229
virtual void close() override
230230
{
231231
if (channel_ && channel_->is_active())
232+
{
232233
channel_->close();
234+
channel_ = nullptr;
235+
}
233236
}
234237

235238
virtual void startEncryption() override

0 commit comments

Comments
 (0)