From: Vsevolod Stakhov Date: Thu, 29 Jan 2026 16:35:35 +0000 (+0000) Subject: [Fix] re_cache: initialize async context to prevent random callback skipping X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23e711c55e28d93e1ce3e1d58a3da574ea070cd8;p=thirdparty%2Frspamd.git [Fix] re_cache: initialize async context to prevent random callback skipping Use g_malloc0 instead of g_malloc when allocating rspamd_re_cache_async_ctx to ensure callback_processed flag is initialized to FALSE. Without this, the flag could randomly be TRUE (from uninitialized memory), causing the exists/save callbacks to be silently skipped and preventing re_class compilation from proceeding after cache misses. --- diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c index d4cc43bc2..a7a3b2c69 100644 --- a/src/libserver/re_cache.c +++ b/src/libserver/re_cache.c @@ -2410,7 +2410,7 @@ rspamd_re_cache_compile_timer_cb(EV_P_ ev_timer *w, int revents) if (cbdata->state == RSPAMD_RE_CACHE_COMPILE_STATE_CHECK_EXISTS) { /* Check via Lua backend (handles file, redis, http) */ - struct rspamd_re_cache_async_ctx *ctx = g_malloc(sizeof(*ctx)); + struct rspamd_re_cache_async_ctx *ctx = g_malloc0(sizeof(*ctx)); ctx->cbdata = cbdata; ctx->loop = loop; ctx->w = w; @@ -2651,7 +2651,7 @@ rspamd_re_cache_compile_timer_cb(EV_P_ ev_timer *w, int revents) offset += iov[j].iov_len; } - struct rspamd_re_cache_async_ctx *ctx = g_malloc(sizeof(*ctx)); + struct rspamd_re_cache_async_ctx *ctx = g_malloc0(sizeof(*ctx)); ctx->cbdata = cbdata; ctx->loop = loop; ctx->w = w;