aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_regexp.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-12 09:53:08 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-12 09:53:08 +0100
commit42a4b088c79eb86aa44cd44ce7d19c862e5289b9 (patch)
tree3d6bb56d6368c30a3bd97814e5ae55db83eec25d /src/lua/lua_regexp.c
parent08ffbddaa8671a83ccaa08bd4a4d25b1342066d9 (diff)
downloadrspamd-42a4b088c79eb86aa44cd44ce7d19c862e5289b9.tar.gz
rspamd-42a4b088c79eb86aa44cd44ce7d19c862e5289b9.zip
[Fix] Fix crash due to constructors init order
Issue: #3079
Diffstat (limited to 'src/lua/lua_regexp.c')
-rw-r--r--src/lua/lua_regexp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lua/lua_regexp.c b/src/lua/lua_regexp.c
index ae1f2007a..764bb6de1 100644
--- a/src/lua/lua_regexp.c
+++ b/src/lua/lua_regexp.c
@@ -889,16 +889,16 @@ lua_load_regexp (lua_State * L)
void
luaopen_regexp (lua_State * L)
{
+ if (!regexp_static_pool) {
+ regexp_static_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
+ "regexp_lua_pool");
+ }
+
rspamd_lua_new_class (L, "rspamd{regexp}", regexplib_m);
lua_pop (L, 1);
rspamd_lua_add_preload (L, "rspamd_regexp", lua_load_regexp);
}
-RSPAMD_CONSTRUCTOR (lua_re_static_pool_ctor) {
- regexp_static_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
- "regexp_lua_pool");
-}
-
RSPAMD_DESTRUCTOR (lua_re_static_pool_dtor) {
rspamd_mempool_delete (regexp_static_pool);
} \ No newline at end of file