From 5bf1a1a224ba338dceb638691c8dc1bf4be9a866 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 29 Oct 2022 10:24:28 +0100 Subject: [PATCH] [Minor] Fix static memory leak in redis stat --- src/libstat/backends/redis_backend.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c index fa69341f1..883d3d00c 100644 --- a/src/libstat/backends/redis_backend.c +++ b/src/libstat/backends/redis_backend.c @@ -1076,6 +1076,14 @@ rspamd_redis_async_stat_fin (struct rspamd_stat_async_elt *elt, gpointer d) rspamd_redis_async_cbdata_cleanup (redis_elt->cbdata); redis_elt->cbdata = NULL; } + + /* Clear the static elements */ + if (redis_elt->stat) { + ucl_object_unref(redis_elt->stat); + redis_elt->stat = NULL; + } + + g_free (redis_elt); } /* Called on connection termination */ -- 2.39.5