aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-05 12:42:43 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-05 12:42:43 +0000
commitb35299b4e3a6cf75cfa19783dda35411508d2913 (patch)
treeda78386cf112c62a0bf81fd04f4d243660e24f28 /src/libserver
parentf29fb4de499b145b29a1cb22b0f7c0f81473ff6b (diff)
downloadrspamd-b35299b4e3a6cf75cfa19783dda35411508d2913.tar.gz
rspamd-b35299b4e3a6cf75cfa19783dda35411508d2913.zip
Fix leaks in lua error paths
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/cfg_rcl.c2
-rw-r--r--src/libserver/cfg_utils.c2
-rw-r--r--src/libserver/symbols_cache.c1
-rw-r--r--src/libserver/task.c1
4 files changed, 5 insertions, 1 deletions
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index df9768792..ffc6f9086 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -772,7 +772,7 @@ rspamd_rcl_lua_handler (rspamd_mempool_t *pool, const ucl_object_t *obj,
lua_src,
tb->str);
g_string_free (tb, TRUE);
- lua_pop (L, 1);
+ lua_pop (L, 2);
if (chdir (cur_dir) == -1) {
msg_err_config ("cannot chdir to %s: %s", cur_dir,
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index 6ecd7b429..66a67fe13 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -379,6 +379,8 @@ rspamd_config_process_var (struct rspamd_config *cfg, const rspamd_ftok_t *var,
if (lua_pcall (cfg->lua_state, 0, 1, 0) != 0) {
msg_err_config ("error executing lua code: '%T': %s", content,
lua_tostring (cfg->lua_state, -1));
+ lua_pop (cfg->lua_state, 1);
+
return FALSE;
}
diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c
index 53c065dfd..50012c1a9 100644
--- a/src/libserver/symbols_cache.c
+++ b/src/libserver/symbols_cache.c
@@ -1048,6 +1048,7 @@ rspamd_symbols_cache_check_symbol (struct rspamd_task *task,
if (lua_pcall (L, 1, 1, 0) != 0) {
msg_info_task ("call to condition for %s failed: %s",
item->symbol, lua_tostring (L, -1));
+ lua_pop (L, 1);
}
else {
check = lua_toboolean (L, -1);
diff --git a/src/libserver/task.c b/src/libserver/task.c
index 4194ac94c..1220dc4bc 100644
--- a/src/libserver/task.c
+++ b/src/libserver/task.c
@@ -1076,6 +1076,7 @@ rspamd_task_write_log (struct rspamd_task *task)
if (lua_pcall (L, 1, 1, 0) != 0) {
msg_err_task ("call to log function failed: %s",
lua_tostring (L, -1));
+ lua_pop (L, 1);
}
else {
lua_str = lua_tolstring (L, -1, &lua_str_len);