aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/backends
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-16 12:44:18 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-16 12:44:18 +0100
commit8031433c33fb57fe274d3f14dba3a8671295882e (patch)
tree2d60b08ab5369d6b5c59f2b0d56ac8a82f70f479 /src/libstat/backends
parentcb4e67963b6e5a4c58c77e39c10517d0ba3af068 (diff)
downloadrspamd-8031433c33fb57fe274d3f14dba3a8671295882e.tar.gz
rspamd-8031433c33fb57fe274d3f14dba3a8671295882e.zip
[Fix] Set terminated state before calling of async free
Diffstat (limited to 'src/libstat/backends')
-rw-r--r--src/libstat/backends/redis_backend.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c
index cb7f0f75b..275487a95 100644
--- a/src/libstat/backends/redis_backend.c
+++ b/src/libstat/backends/redis_backend.c
@@ -904,8 +904,8 @@ rspamd_redis_learned (redisAsyncContext *c, gpointer r, gpointer priv)
}
if (rt->conn_state == RSPAMD_REDIS_CONNECTED) {
- redisAsyncFree (rt->redis);
rt->conn_state = RSPAMD_REDIS_TERMINATED;
+ redisAsyncFree (rt->redis);
}
REF_RELEASE (rt);
@@ -1236,11 +1236,10 @@ rspamd_redis_finalize_process (struct rspamd_task *task, gpointer runtime,
if (rt->conn_state == RSPAMD_REDIS_CONNECTED) {
event_del (&rt->timeout_event);
- redisAsyncFree (rt->redis);
- rt->redis = NULL;
-
rt->conn_state = RSPAMD_REDIS_TERMINATED;
+ redisAsyncFree (rt->redis);
+ rt->redis = NULL;
REF_RELEASE (rt);
}
}
@@ -1375,10 +1374,9 @@ rspamd_redis_finalize_learn (struct rspamd_task *task, gpointer runtime,
if (rt->conn_state == RSPAMD_REDIS_CONNECTED) {
event_del (&rt->timeout_event);
+ rt->conn_state = RSPAMD_REDIS_TERMINATED;
redisAsyncFree (rt->redis);
rt->redis = NULL;
-
- rt->conn_state = RSPAMD_REDIS_TERMINATED;
REF_RELEASE (rt);
}
}
@@ -1433,10 +1431,9 @@ rspamd_redis_get_stat (gpointer runtime,
if (rt->redis) {
event_del (&rt->timeout_event);
+ rt->conn_state = RSPAMD_REDIS_TERMINATED;
redisAsyncFree (rt->redis);
rt->redis = NULL;
-
- rt->conn_state = RSPAMD_REDIS_TERMINATED;
}
if (st->stat) {