]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix various static leaks
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 27 Sep 2019 11:47:08 +0000 (12:47 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 27 Sep 2019 11:47:08 +0000 (12:47 +0100)
src/client/rspamc.c
src/libserver/cfg_rcl.c
src/lua/lua_config.c
src/lua/lua_util.c

index 3036694050bf61a55312d9ce19735b71a84669f3..3f637cda035f9548e78bb2ed7a5480e045ac1178 100644 (file)
@@ -411,6 +411,7 @@ read_cmd_line (gint *argc, gchar ***argv)
        /* Parse options */
        if (!g_option_context_parse (context, argc, argv, &error)) {
                fprintf (stderr, "option parsing failed: %s\n", error->message);
+               g_option_context_free (context);
                exit (EXIT_FAILURE);
        }
 
@@ -418,6 +419,7 @@ read_cmd_line (gint *argc, gchar ***argv)
                raw = TRUE;
        }
        /* Argc and argv are shifted after this function */
+       g_option_context_free (context);
 }
 
 static gboolean
index 04bd9eefc5a2ca66e9c4798e1f857b591823e2b8..b219e1af80361f05e70c9afd2690914e327ff6da 100644 (file)
@@ -3932,6 +3932,9 @@ rspamd_config_read (struct rspamd_config *cfg,
        }
 
        cfg->lang_det = rspamd_language_detector_init (cfg);
+       rspamd_mempool_add_destructor (cfg->cfg_pool,
+                       (rspamd_mempool_destruct_t)rspamd_language_detector_unref,
+                       cfg->lang_det);
 
        return TRUE;
 }
index 5c914af79123db507524f9262a556eaf2a118d51..f047f1530df5d6c7474f8013bcc1c45b1d57ce98 100644 (file)
@@ -4157,7 +4157,12 @@ lua_config_init_subsystem (lua_State *L)
                                rspamd_init_filters (cfg, FALSE);
                        }
                        else if (strcmp (parts[i], "langdet") == 0) {
-                               cfg->lang_det = rspamd_language_detector_init (cfg);
+                               if (!cfg->lang_det) {
+                                       cfg->lang_det = rspamd_language_detector_init (cfg);
+                                       rspamd_mempool_add_destructor (cfg->cfg_pool,
+                                                       (rspamd_mempool_destruct_t) rspamd_language_detector_unref,
+                                                       cfg->lang_det);
+                               }
                        }
                        else if (strcmp (parts[i], "stat") == 0) {
                                rspamd_stat_init (cfg, NULL);
index f86f975e76f4650c2c7a56d60cf334d269e8525f..026e6e822ac1336c84bc687743ff8a5bef74bc75 100644 (file)
@@ -822,7 +822,6 @@ lua_util_config_from_ucl (lua_State *L)
                cfg->lua_state = L;
 
                cfg->rcl_obj = obj;
-               cfg->cache = rspamd_symcache_new (cfg);
                top = rspamd_rcl_config_init (cfg, NULL);
 
                if (!rspamd_rcl_parse (top, cfg, cfg, cfg->cfg_pool, cfg->rcl_obj, &err)) {