diff --git a/src/messaging/ExchangeContext.cpp b/src/messaging/ExchangeContext.cpp index 0e22df855c04de..216e92e0742092 100644 --- a/src/messaging/ExchangeContext.cpp +++ b/src/messaging/ExchangeContext.cpp @@ -345,37 +345,6 @@ void ExchangeContext::Free() SYSTEM_STATS_DECREMENT(chip::System::Stats::kExchangeMgr_NumContexts); } -void ExchangeContext::ForceFree() -{ - VerifyOrDie(mExchangeMgr != nullptr); - - ExchangeManager * em = mExchangeMgr; - - if (mDelegate != nullptr) - { - mDelegate->OnExchangeClosing(this); - } - mDelegate = nullptr; - - CancelResponseTimer(); - - mExchangeMgr = nullptr; - - em->DecrementContextsInUse(); - - if (mExchangeACL != nullptr) - { - chip::Platform::Delete(mExchangeACL); - mExchangeACL = nullptr; - } - -#if defined(CHIP_EXCHANGE_CONTEXT_DETAIL_LOGGING) - ChipLogProgress(ExchangeManager, "ec-- id: %d [%04" PRIX16 "], inUse: %d, addr: 0x%x", (this - em->ContextPool + 1), - mExchangeId, em->GetContextsInUse(), this); -#endif - SYSTEM_STATS_DECREMENT(chip::System::Stats::kExchangeMgr_NumContexts); -} - bool ExchangeContext::MatchExchange(SecureSessionHandle session, const PacketHeader & packetHeader, const PayloadHeader & payloadHeader) { diff --git a/src/messaging/ExchangeContext.h b/src/messaging/ExchangeContext.h index ed6ab141f5df88..0042c9af2aa4ac 100644 --- a/src/messaging/ExchangeContext.h +++ b/src/messaging/ExchangeContext.h @@ -183,7 +183,6 @@ class DLL_EXPORT ExchangeContext : public ReferenceCounted 0) - { - ChipLogError(ExchangeManager, "Exchange (id: %d) leaked", ec.GetExchangeId()); - ec.ForceFree(); - } + // ExchangeContext leaked + assert(ec.GetReferenceCount() == 0); } if (mSessionMgr != nullptr)