diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-10-04 17:21:16 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-10-04 17:21:16 +0100 |
commit | 315ecdf30dfefa0316b608cc37d867795499419e (patch) | |
tree | 37c33ac31a09b5968f5decd0d478fbdd35af49e8 /src | |
parent | 6c57c656955c6ab3577a1e4a5477379b01471889 (diff) | |
download | rspamd-315ecdf30dfefa0316b608cc37d867795499419e.tar.gz rspamd-315ecdf30dfefa0316b608cc37d867795499419e.zip |
[Minor] Prevent race condition in Redis ctx refcounting
Diffstat (limited to 'src')
-rw-r--r-- | src/lua/lua_redis.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c index d3eaa300a..5b2ba0062 100644 --- a/src/lua/lua_redis.c +++ b/src/lua/lua_redis.c @@ -480,6 +480,8 @@ lua_redis_push_results (struct lua_redis_ctx *ctx, lua_State *L) static void lua_redis_cleanup_events (struct lua_redis_ctx *ctx) { + REDIS_RETAIN (ctx); /* To avoid preliminary destruction */ + while (!g_queue_is_empty (ctx->events_cleanup)) { struct lua_redis_result *result = g_queue_pop_head (ctx->events_cleanup); @@ -488,6 +490,8 @@ lua_redis_cleanup_events (struct lua_redis_ctx *ctx) g_free (result); } + + REDIS_RELEASE (ctx); } /** |