commit fb2b4fd: [Minor] Fix leak

Vsevolod Stakhov vsevolod at rspamd.com
Sun Aug 20 18:49:04 UTC 2023


Author: Vsevolod Stakhov
Date: 2023-08-20 19:24:53 +0100
URL: https://github.com/rspamd/rspamd/commit/fb2b4fdb843c88ae5222271d498a17dec4d4ea8b

[Minor] Fix leak

---
 src/libserver/cfg_rcl.cxx | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/libserver/cfg_rcl.cxx b/src/libserver/cfg_rcl.cxx
index 310d89391..a20cd572d 100644
--- a/src/libserver/cfg_rcl.cxx
+++ b/src/libserver/cfg_rcl.cxx
@@ -68,6 +68,13 @@ struct rspamd_rcl_section {
 	rspamd_rcl_section_fin_t fin{};                                                                   /** called at the end of section parsing */
 	gpointer fin_ud{};
 	ucl_object_t *doc_ref{}; /**< reference to the section's documentation */
+
+	virtual ~rspamd_rcl_section()
+	{
+		if (doc_ref) {
+			ucl_object_unref(doc_ref);
+		}
+	}
 };
 
 struct rspamd_worker_param_parser {


More information about the Commits mailing list