From: Vsevolod Stakhov Date: Fri, 19 Dec 2025 12:28:12 +0000 (+0000) Subject: Revert "[Fix] Release Redis connection in lua_redis_fin to avoid double-free" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a783da2689668cbbac2552ef402abeb21161b212;p=thirdparty%2Frspamd.git Revert "[Fix] Release Redis connection in lua_redis_fin to avoid double-free" This reverts commit b8de1b2542dedf8ab92a51e74b6f2a27c8d70e7b. --- diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c index 769519c2e5..4f70025472 100644 --- a/src/lua/lua_redis.c +++ b/src/lua/lua_redis.c @@ -261,7 +261,6 @@ lua_redis_fin(void *arg) struct lua_redis_request_specific_userdata *sp_ud = arg; struct lua_redis_userdata *ud; struct lua_redis_ctx *ctx; - redisAsyncContext *ac; ctx = sp_ud->ctx; ud = sp_ud->common_ud; @@ -273,18 +272,8 @@ lua_redis_fin(void *arg) msg_debug_lua_redis("finished redis query %p from session %p; refcount=%d", sp_ud, ctx, ctx->ref.refcount); sp_ud->flags |= LUA_REDIS_SPECIFIC_FINISHED; - - if (!ud->terminated) { - /* Release Redis connection to prevent callbacks after session cleanup */ - ud->terminated = 1; - ac = ud->ctx; - ud->ctx = NULL; - - if (ac) { - rspamd_redis_pool_release_connection(ud->pool, ac, - RSPAMD_REDIS_RELEASE_FATAL); - } - } + /* Prevent callbacks from accessing task data after session cleanup */ + ud->terminated = 1; REDIS_RELEASE(ctx); }