From 83ca87111d8bfdfb8933f6e7063d6b3c8ac01179 Mon Sep 17 00:00:00 2001
From: "roman.khlopkov" <roman.khlopkov@demlabs.net>
Date: Thu, 16 May 2024 20:21:50 +0300
Subject: [PATCH] [-] Debug hook for double-free of legacy context

---
 modules/chain/dap_chain_ch.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/modules/chain/dap_chain_ch.c b/modules/chain/dap_chain_ch.c
index bbb2422d91..cd9cc9923d 100644
--- a/modules/chain/dap_chain_ch.c
+++ b/modules/chain/dap_chain_ch.c
@@ -125,8 +125,6 @@ struct legacy_sync_context {
     dap_time_t last_activity;
     dap_chain_ch_state_t prev_state;
     size_t enqueued_data_size;
-
-    bool is_deleted;
 };
 
 typedef struct dap_chain_ch {
@@ -329,11 +327,6 @@ static void s_legacy_sync_context_delete(void *a_arg)
     struct legacy_sync_context *l_context = a_arg;
     dap_return_if_fail(l_context);
 
-    if (l_context->is_deleted) {
-        log_it(L_CRITICAL, "Trying to double-free legacy context %p");
-        return;
-    }
-
     dap_chain_ch_hash_item_t *l_hash_item, *l_tmp;
 
     if (l_context->is_type_of_gdb) {
@@ -365,8 +358,7 @@ static void s_legacy_sync_context_delete(void *a_arg)
         l_ch->stream->esocket->callbacks.arg = NULL;
     }
 
-    l_context->is_deleted = true;
-    //DAP_DELETE(l_context);
+    DAP_DELETE(l_context);
 }
 
 static bool s_sync_out_gdb_proc_callback(void *a_arg)
-- 
GitLab