From ae5b750d304466de8cb43664969881787a94742f Mon Sep 17 00:00:00 2001 From: Suvesh Pratapa <66088488+suveshpratapa@users.noreply.github.com> Date: Wed, 27 Nov 2024 18:36:33 -0500 Subject: [PATCH] [cli] set `mUseTls` to false after de-initializing TCP session (#10977) Avoid SSL context operations in TCP callbacks (for eg. `HandleTcpDisconnected`) when the context could have already been de-allocated after de-initialization. --- src/cli/cli_tcp.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cli/cli_tcp.cpp b/src/cli/cli_tcp.cpp index d243251a4..7471e661a 100644 --- a/src/cli/cli_tcp.cpp +++ b/src/cli/cli_tcp.cpp @@ -304,6 +304,8 @@ template <> otError TcpExample::Process(Arg aArgs[]) mbedtls_pk_free(&mPKey); mbedtls_x509_crt_free(&mSrvCert); + + mUseTls = false; } #endif