From: Vsevolod Stakhov Date: Tue, 26 Jan 2016 13:57:28 +0000 (+0000) Subject: Try to fix memory leak on redis stat X-Git-Tag: 1.1.2~32 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9216b42e39225e28c20e452a1c389929ba8ba7b8;p=rspamd.git Try to fix memory leak on redis stat Issue: #500 Reported by: @mozzan --- diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c index 808959d73..a4c62e426 100644 --- a/src/libstat/backends/redis_backend.c +++ b/src/libstat/backends/redis_backend.c @@ -1311,6 +1311,13 @@ rspamd_redis_get_stat (gpointer runtime, if (rt->ctx->stat_elt) { st = rt->ctx->stat_elt->ud; + if (rt->redis) { + event_del (&rt->timeout_event); + redisAsyncFree (rt->redis); + + rt->conn_state = RSPAMD_REDIS_DISCONNECTED; + } + if (st->stat) { return ucl_object_ref (st->stat); }