]> source.dussan.org Git - rspamd.git/commitdiff
Try to fix memory leak on redis stat
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 Jan 2016 13:57:28 +0000 (13:57 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 Jan 2016 13:57:28 +0000 (13:57 +0000)
Issue: #500
Reported by: @mozzan

src/libstat/backends/redis_backend.c

index 808959d73d404cc77ab27a79405c3b2e6f1e0eba..a4c62e42630876028bcf1369f8a92a94c61067ca 100644 (file)
@@ -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);
                }