From f3ac1cbb06c398221a1ff1aeb57ed10908d9be8d Mon Sep 17 00:00:00 2001 From: Evgeny Date: Thu, 16 Jul 2026 19:24:13 +0300 Subject: [PATCH] =?UTF-8?q?chat=5Fsync:=20fix=20double-free=20in=20auto=5F?= =?UTF-8?q?connect=20=E2=80=94=20clear=20ca=5Fstate=20in=20ac=5Fresult=5Fc?= =?UTF-8?q?b=20on=20success?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/chatgui/transport/chat_sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/chatgui/transport/chat_sync.c b/tools/chatgui/transport/chat_sync.c index b165a3b3..e32289fa 100644 --- a/tools/chatgui/transport/chat_sync.c +++ b/tools/chatgui/transport/chat_sync.c @@ -199,7 +199,7 @@ static void ac_result_cb(int result, uint64_t node_id, void* arg) { if (!g_ac || !g_ac->active) return; const char* rs = result == CONN_MGR_OK ? "OK" : "FAIL"; DEBUG_INFO(DEBUG_CATEGORY_CONNECTIVITY, "%s: result node=0x%016llx %s", AC_ID, (unsigned long long)node_id, rs); - /* DON'T clear ca_state — GC will close connection and free slot after AC_GC_TIMEOUT_MS */ + if (result == CONN_MGR_OK) f->ca_state = NULL; /* already freed by ca_ready_cb, prevent double-free in GC/stop */ } /* ── retry timer callback (every AC_RETRY_MS) ── */