Fix race condition 26/307126/1
authorChanggyu Choi <changyu.choi@samsung.com>
Tue, 5 Mar 2024 07:13:15 +0000 (16:13 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Tue, 5 Mar 2024 07:13:28 +0000 (16:13 +0900)
disposed_ flag must be checked after locking mutex.

Change-Id: I19839145d10d9c51486c4f49450cd4098b7b75d2
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
src/debug-port-internal.cc

index df51d5b..eabe432 100644 (file)
@@ -218,10 +218,10 @@ int DebugPortImpl::Send(int port, bool is_read, uint32_t seq,
 }
 
 void DebugPortImpl::Init() {
+  std::lock_guard<std::recursive_mutex> lock(GetMutex());
   if (!disposed_)
     return;
 
-  std::lock_guard<std::recursive_mutex> lock(GetMutex());
   aul_app_com_create_async(ENDPOINT_RPC_PORT_DEBUG, nullptr, AppComCb, this,
       &conn_);
   if (conn_ == nullptr)