mirror of
https://github.com/espressif/openthread.git
synced 2026-08-15 23:27:47 +00:00
[secure-transport] add ~SecureTransport() destructor (#11562)
This commit adds a destructor for `SecureTransport` that closes the socket, and disconnects and removes any tracked sessions. Removing the sessions ensures that the `SecureSession` instances and any data allocated within them are properly freed. This handles the case where the `otInstance` itself is destroyed, ensuring that all heap-allocated items are cleaned up correctly to prevent memory leaks.
This commit is contained in:
@@ -721,6 +721,7 @@ public:
|
||||
|
||||
protected:
|
||||
SecureTransport(Instance &aInstance, LinkSecurityMode aLayerTwoSecurity, bool aDatagramTransport);
|
||||
~SecureTransport(void) { Close(); }
|
||||
|
||||
#if OPENTHREAD_CONFIG_TLS_API_ENABLE
|
||||
void SetExtension(Extension &aExtension) { mExtension = &aExtension; }
|
||||
|
||||
Reference in New Issue
Block a user