From 60d2aec4a24aec1db345136b5284e5daf7717eb4 Mon Sep 17 00:00:00 2001
From: Roman Khlopkov <roman.khlopkov@demlabs.net>
Date: Fri, 31 Mar 2023 08:58:55 +0300
Subject: [PATCH] [*] esbocs timer segfault fix

---
 modules/consensus/esbocs/dap_chain_cs_esbocs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/consensus/esbocs/dap_chain_cs_esbocs.c b/modules/consensus/esbocs/dap_chain_cs_esbocs.c
index d48bfa1e6d..ad37664318 100644
--- a/modules/consensus/esbocs/dap_chain_cs_esbocs.c
+++ b/modules/consensus/esbocs/dap_chain_cs_esbocs.c
@@ -481,8 +481,10 @@ static void s_session_round_new(dap_chain_esbocs_session_t *a_session)
     a_session->cur_round.id++;
     a_session->cur_round.sync_attempt++;
 
-    dap_timerfd_delete_mt(a_session->sync_timer->worker, a_session->sync_timer->esocket_uuid);
-    a_session->sync_timer = NULL;
+    if (a_session->sync_timer) {
+        dap_timerfd_delete_mt(a_session->sync_timer->worker, a_session->sync_timer->esocket_uuid);
+        a_session->sync_timer = NULL;
+    }
     a_session->state = DAP_CHAIN_ESBOCS_SESSION_STATE_WAIT_START;
     a_session->ts_round_sync_start = 0;
     a_session->ts_attempt_start = 0;
-- 
GitLab