]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Change deinit order
authorMikhail Galanin <mgalanin@mimecast.com>
Mon, 10 Sep 2018 14:14:05 +0000 (15:14 +0100)
committerMikhail Galanin <mgalanin@mimecast.com>
Mon, 10 Sep 2018 14:14:05 +0000 (15:14 +0100)
some destructors in Lua could require Redis pool, that is why the pool should be shud down after lua_state.
While redis pool is created in the mempool.

src/libserver/cfg_utils.c

index 016556912253f9697bef0d4bf5b41d2396e15794..d079393744e0ee25be05dd0a53165245da2ffe42 100644 (file)
@@ -232,11 +232,6 @@ rspamd_config_free (struct rspamd_config *cfg)
        g_list_free (cfg->classifiers);
        g_list_free (cfg->workers);
        rspamd_symbols_cache_destroy (cfg->cache);
-#ifdef WITH_HIREDIS
-       if (cfg->redis_pool) {
-               rspamd_redis_pool_destroy (cfg->redis_pool);
-       }
-#endif
        ucl_object_unref (cfg->rcl_obj);
        ucl_object_unref (cfg->config_comments);
        ucl_object_unref (cfg->doc_strings);
@@ -257,13 +252,21 @@ rspamd_config_free (struct rspamd_config *cfg)
 
        rspamd_re_cache_unref (cfg->re_cache);
        rspamd_upstreams_library_unref (cfg->ups_ctx);
-       rspamd_mempool_delete (cfg->cfg_pool);
        g_ptr_array_free (cfg->c_modules, TRUE);
 
        if (cfg->lua_state && cfg->own_lua_state) {
                lua_thread_pool_free (cfg->lua_thread_pool);
                lua_close (cfg->lua_state);
        }
+
+#ifdef WITH_HIREDIS
+       if (cfg->redis_pool) {
+               rspamd_redis_pool_destroy (cfg->redis_pool);
+       }
+#endif
+
+       rspamd_mempool_delete (cfg->cfg_pool);
+
        REF_RELEASE (cfg->libs_ctx);
 
        DL_FOREACH_SAFE (cfg->log_pipes, lp, ltmp) {