diff --git a/src/credentials/GroupDataProviderImpl.cpp b/src/credentials/GroupDataProviderImpl.cpp index 40e80c666727b4..62180ebc2183e1 100644 --- a/src/credentials/GroupDataProviderImpl.cpp +++ b/src/credentials/GroupDataProviderImpl.cpp @@ -891,6 +891,8 @@ void GroupDataProviderImpl::Finish() mGroupKeyIterators.ReleaseAll(); mEndpointIterators.ReleaseAll(); mKeySetIterators.ReleaseAll(); + mGroupSessionsIterator.ReleaseAll(); + mKeyContexPool.ReleaseAll(); } // diff --git a/src/inet/tests/TestInetCommonPosix.cpp b/src/inet/tests/TestInetCommonPosix.cpp index 86120482e8e55d..57494e2486986e 100644 --- a/src/inet/tests/TestInetCommonPosix.cpp +++ b/src/inet/tests/TestInetCommonPosix.cpp @@ -499,7 +499,16 @@ static void OnLwIPInitComplete(void * arg) void ShutdownNetwork() { + gTCP.ForEachEndPoint([](TCPEndPoint * lEndPoint) -> Loop { + gTCP.ReleaseEndPoint(lEndPoint); + return Loop::Continue; + }); gTCP.Shutdown(); + + gUDP.ForEachEndPoint([](UDPEndPoint * lEndPoint) -> Loop { + gUDP.ReleaseEndPoint(lEndPoint); + return Loop::Continue; + }); gUDP.Shutdown(); #if CHIP_SYSTEM_CONFIG_USE_LWIP ReleaseLwIP(); diff --git a/src/lib/support/Pool.h b/src/lib/support/Pool.h index 2a28850c4841b2..a3750b7d4f960d 100644 --- a/src/lib/support/Pool.h +++ b/src/lib/support/Pool.h @@ -296,6 +296,13 @@ class HeapObjectPool : public internal::Statistics, public internal::PoolCommon< HeapObjectPool() {} ~HeapObjectPool() { +#ifndef __SANITIZE_ADDRESS__ +#ifdef __clang__ +#if __has_feature(address_sanitizer) +#define __SANITIZE_ADDRESS__ 1 +#endif +#endif +#endif #if __SANITIZE_ADDRESS__ // Free all remaining objects so that ASAN can catch specific use-after-free cases. ReleaseAll(); diff --git a/src/system/SystemLayerImplSelect.cpp b/src/system/SystemLayerImplSelect.cpp index 1feaf7d3feb7ad..e3b75eb81faee3 100644 --- a/src/system/SystemLayerImplSelect.cpp +++ b/src/system/SystemLayerImplSelect.cpp @@ -75,9 +75,8 @@ CHIP_ERROR LayerImplSelect::Shutdown() dispatch_source_cancel(timer->mTimerSource); dispatch_release(timer->mTimerSource); } - - mTimerPool.Release(timer); } + mTimerPool.ReleaseAll(); #else // CHIP_SYSTEM_CONFIG_USE_DISPATCH mTimerList.Clear(); mTimerPool.ReleaseAll(); diff --git a/src/transport/raw/tests/NetworkTestHelpers.cpp b/src/transport/raw/tests/NetworkTestHelpers.cpp index b29c33bc85de25..cf97220cc52270 100644 --- a/src/transport/raw/tests/NetworkTestHelpers.cpp +++ b/src/transport/raw/tests/NetworkTestHelpers.cpp @@ -49,7 +49,7 @@ CHIP_ERROR IOContext::Shutdown() CHIP_ERROR err = CHIP_NO_ERROR; ShutdownNetwork(); - gSystemLayer.Shutdown(); + ShutdownSystemLayer(); Platform::MemoryShutdown(); return err;