aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/redis_pool.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-11-20 17:31:42 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-11-20 17:31:42 +0000
commit0a236ecb96a47a3a08e45f0a5562aeb39f4256ea (patch)
tree56e571ec4c04ad3fca59f818f61d9e4665a20784 /src/libserver/redis_pool.c
parent6de05c338a67aa934398f0f137e5e396d677163c (diff)
downloadrspamd-0a236ecb96a47a3a08e45f0a5562aeb39f4256ea.tar.gz
rspamd-0a236ecb96a47a3a08e45f0a5562aeb39f4256ea.zip
[CritFix] Add guards for inactive redis connections
Diffstat (limited to 'src/libserver/redis_pool.c')
-rw-r--r--src/libserver/redis_pool.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libserver/redis_pool.c b/src/libserver/redis_pool.c
index 1efc4f743..ef5951cfa 100644
--- a/src/libserver/redis_pool.c
+++ b/src/libserver/redis_pool.c
@@ -115,11 +115,15 @@ rspamd_redis_pool_conn_dtor (struct rspamd_redis_pool_connection *conn)
event_del (&conn->timeout);
}
- if (conn->ctx) {
+ if (conn->ctx && !(conn->ctx->c->flags & REDIS_FREEING)) {
+ redisAsyncContext *ac = conn->ctx;
+
/* To prevent on_disconnect here */
conn->active = TRUE;
g_hash_table_remove (conn->elt->pool->elts_by_ctx, conn->ctx);
- redisAsyncFree (conn->ctx);
+ conn->ctx = NULL;
+ ac->onDisconnect = NULL;
+ redisAsyncFree (ac);
}
g_queue_unlink (conn->elt->inactive, conn->entry);