From 91016039aac6fc2d9f8289bad8850af09820f113 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 20 Apr 2016 12:06:04 +0100 Subject: [PATCH] [Fix] Fix crash on redis learn --- src/libstat/backends/redis_backend.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c index 88aa0d919..9b71b1a17 100644 --- a/src/libstat/backends/redis_backend.c +++ b/src/libstat/backends/redis_backend.c @@ -886,8 +886,10 @@ rspamd_redis_learned (redisAsyncContext *c, gpointer r, gpointer priv) rspamd_session_remove_event (task->s, rspamd_redis_fin_learn, rt); } - redisAsyncFree (rt->redis); - rt->conn_state = RSPAMD_REDIS_DISCONNECTED; + if (rt->conn_state == RSPAMD_REDIS_CONNECTED) { + redisAsyncFree (rt->redis); + rt->conn_state = RSPAMD_REDIS_DISCONNECTED; + } } static gboolean -- 2.39.5