diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-10-14 21:22:29 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-10-14 21:22:29 +0300 |
commit | f355b1b4948b0f394e024b6bbc6ad0ec26c39eff (patch) | |
tree | 2137511e7b4332806e36e83511766f1567a41435 | |
parent | 4e9aeb3c4ffc69daff061c8b870f1a228bb78175 (diff) | |
download | rspamd-f355b1b4948b0f394e024b6bbc6ad0ec26c39eff.tar.gz rspamd-f355b1b4948b0f394e024b6bbc6ad0ec26c39eff.zip |
Fix stupid bug with lua stack corruption.
-rw-r--r-- | src/lua/lua_classifier.c | 1 | ||||
-rw-r--r-- | src/lua/lua_common.c | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/lua/lua_classifier.c b/src/lua/lua_classifier.c index 32d4f88ed..0bf0daca8 100644 --- a/src/lua/lua_classifier.c +++ b/src/lua/lua_classifier.c @@ -109,7 +109,6 @@ call_classifier_pre_callback (struct classifier_config *ccf, struct worker_task lua_pop (L, 1); } } - lua_pop (L, 1); } return res; diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index 67206b8ef..990be90ef 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -384,12 +384,15 @@ lua_call_expression_func (const gchar *module, const gchar *function, lua_pop (L, 1); lua_getglobal (L, function); } - else { + else if (lua_istable (L, -1)) { /* Call local function in table */ lua_pushstring (L, function); lua_gettable (L, -2); pop += 2; } + else { + msg_err ("Bad type: %s for function: %s for module: %s", lua_typename (L, lua_type (L, -1)), function, module); + } } else { /* Try to get global variable */ @@ -441,6 +444,8 @@ lua_call_expression_func (const gchar *module, const gchar *function, return FALSE; } *res = lua_toboolean (L, -1); + lua_gc (L, LUA_GCCOLLECT, 0); + msg_info ("lua eats %d kbytes", lua_gc (L, LUA_GCCOUNT, 0)); lua_pop (L, pop); return TRUE; |