From: Vsevolod Stakhov Date: Mon, 4 Apr 2016 11:40:23 +0000 (+0100) Subject: [Fix] Try to set redis to NULL to avoid double free X-Git-Tag: 1.2.3~76 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b0ff4a4833a848c5e7a56b8bc12834fb7059926e;p=rspamd.git [Fix] Try to set redis to NULL to avoid double free --- diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c index d66b6d68e..88aa0d919 100644 --- a/src/libstat/backends/redis_backend.c +++ b/src/libstat/backends/redis_backend.c @@ -724,6 +724,7 @@ rspamd_redis_timeout (gint fd, short what, gpointer d) rspamd_upstream_fail (rt->selected); rt->conn_state = RSPAMD_REDIS_TIMEDOUT; redisAsyncFree (rt->redis); + rt->redis = NULL; } /* Called when we have connected to the redis server and got stats */ @@ -1202,6 +1203,7 @@ 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_DISCONNECTED; } @@ -1338,6 +1340,7 @@ rspamd_redis_finalize_learn (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_DISCONNECTED; } @@ -1394,6 +1397,7 @@ rspamd_redis_get_stat (gpointer runtime, if (rt->redis) { event_del (&rt->timeout_event); redisAsyncFree (rt->redis); + rt->redis = NULL; rt->conn_state = RSPAMD_REDIS_DISCONNECTED; }