]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Postpone lua state destruction to allow lua dtors to be used
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 26 Jul 2019 12:39:37 +0000 (13:39 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 26 Jul 2019 12:39:37 +0000 (13:39 +0100)
src/libserver/cfg_utils.c

index f65883c3e4b7ccb9bb07cbbc6edf2228b8454298..d6dc95527a4bb7afdb4bec68d4f91dbb4866facf 100644 (file)
@@ -296,11 +296,6 @@ rspamd_config_free (struct rspamd_config *cfg)
        rspamd_upstreams_library_unref (cfg->ups_ctx);
        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);
@@ -319,6 +314,11 @@ rspamd_config_free (struct rspamd_config *cfg)
                g_free (cfg->checksum);
        }
 
+       if (cfg->lua_state && cfg->own_lua_state) {
+               lua_thread_pool_free (cfg->lua_thread_pool);
+               lua_close (cfg->lua_state);
+       }
+
        REF_RELEASE (cfg->libs_ctx);
 
        DL_FOREACH_SAFE (cfg->log_pipes, lp, ltmp) {