diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-06-25 10:04:53 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-06-25 10:04:53 +0100 |
commit | d708a7a7e6038a2c2e68ba06af88c3a810c4e34e (patch) | |
tree | 70031b0a5bc719cf916f8081f8a7ed1cb0c8af4f /src/lua/lua_common.c | |
parent | fe95fc9e1b9914c0a5307cddf8134778197dd4ea (diff) | |
download | rspamd-d708a7a7e6038a2c2e68ba06af88c3a810c4e34e.tar.gz rspamd-d708a7a7e6038a2c2e68ba06af88c3a810c4e34e.zip |
[Minor] Fix logging after switching to luaL_loadbuffer
Diffstat (limited to 'src/lua/lua_common.c')
-rw-r--r-- | src/lua/lua_common.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index 68373c0a9..a33f33791 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -1066,6 +1066,7 @@ rspamd_init_lua_filters (struct rspamd_config *cfg, gboolean force_load) guint8 *data = rspamd_file_xmap (module->path, PROT_READ, &fsize, TRUE); guchar digest[rspamd_cryptobox_HASHBYTES]; + gchar *lua_fname; if (data == NULL) { msg_err_config ("cannot mmap %s failed: %s", module->path, @@ -1086,20 +1087,27 @@ rspamd_init_lua_filters (struct rspamd_config *cfg, gboolean force_load) rspamd_encode_hex_buf (digest, sizeof (digest), module->digest, rspamd_cryptobox_HASHBYTES * 2 + 1); module->digest[rspamd_cryptobox_HASHBYTES * 2] = '\0'; + lua_fname = g_malloc (strlen (module->path) + 2); + rspamd_snprintf (lua_fname, strlen (module->path) + 2, "@%s", + module->path); - - if (luaL_loadbuffer (L, data, fsize, module->path) != 0) { + if (luaL_loadbuffer (L, data, fsize, lua_fname) != 0) { msg_err_config ("load of %s failed: %s", module->path, lua_tostring (L, -1)); lua_settop (L, err_idx - 1); /* Error function */ rspamd_plugins_table_push_elt (L, "disabled_failed", module->name); + munmap (data, fsize); + g_free (lua_fname); cur = g_list_next (cur); continue; } + munmap (data, fsize); + g_free (lua_fname); + /* Initialize config structure */ pcfg = lua_newuserdata (L, sizeof (struct rspamd_config *)); rspamd_lua_setclass (L, "rspamd{config}", -1); |