chat_sync: fix double-free in auto_connect — clear ca_state in ac_result_cb on success

This commit is contained in:
Evgeny committed 2026-07-16 19:24:13 +03:00
1 parent bfa3e666d4
commit f3ac1cbb06
1 file changed
+1 -1
+1 -1
View File
@@ -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) ── */