commit 5bf1a1a: [Minor] Fix static memory leak in redis stat

Vsevolod Stakhov vsevolod at rspamd.com
Sat Oct 29 09:49:04 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-10-29 10:24:28 +0100
URL: https://github.com/rspamd/rspamd/commit/5bf1a1a224ba338dceb638691c8dc1bf4be9a866

[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 */


More information about the Commits mailing list