]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Another leak
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 20 Aug 2023 18:44:57 +0000 (19:44 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 20 Aug 2023 18:45:23 +0000 (19:45 +0100)
src/fuzzy_storage.c

index 21c5c271e59a36c331eb2ad92cc58f76b63a8f73..23a4f45cdbb86e04da5d4abe622525b6fb724dce 100644 (file)
@@ -2227,7 +2227,7 @@ rspamd_fuzzy_maybe_load_ratelimits(struct rspamd_fuzzy_storage_ctx *ctx)
        if (access(path, R_OK) != -1) {
                struct ucl_parser *parser = ucl_parser_new(UCL_PARSER_NO_IMPLICIT_ARRAYS | UCL_PARSER_DISABLE_MACRO);
                if (ucl_parser_add_file(parser, path)) {
-                       const ucl_object_t *obj = ucl_parser_get_object(parser);
+                       ucl_object_t *obj = ucl_parser_get_object(parser);
                        int loaded = 0;
 
                        if (ucl_object_type(obj) == UCL_ARRAY) {
@@ -2274,11 +2274,13 @@ rspamd_fuzzy_maybe_load_ratelimits(struct rspamd_fuzzy_storage_ctx *ctx)
                                        }
                                }
 
-                               ucl_parser_free(parser);
-
                                msg_info("loaded %d ratelimit objects", loaded);
                        }
+
+                       ucl_object_unref(obj);
                }
+
+               ucl_parser_free(parser);
        }
 }