rule->lua_id = lua_tonumber (L, -1);
}
- lua_settop (L, 0);
+ lua_settop (L, err_idx - 1);
rspamd_mempool_add_destructor (cfg->cfg_pool, fuzzy_free_rule,
rule);
if (lua_type (L, -1) == LUA_TTABLE) {
lua_pushstring (L, "fuzzy_check");
- lua_createtable (L, 0, 2);
+ lua_createtable (L, 0, 3);
/* Set methods */
lua_pushstring (L, "unlearn");
lua_pushcfunction (L, fuzzy_lua_unlearn_handler);
gboolean *need_check,
gboolean *fuzzy_check)
{
+ lua_State *L = (lua_State *)task->cfg->lua_state;
+
+ gint old_top = lua_gettop (L);
+
if (rule->lua_id != -1 && rule->ctx->check_mime_part_ref != -1) {
gint err_idx, ret;
- lua_State *L = (lua_State *)task->cfg->lua_state;
+
struct rspamd_task **ptask;
struct rspamd_mime_part **ppart;
*fuzzy_check = lua_toboolean (L, -1);
}
- lua_settop (L, 0);
+ lua_settop (L, old_top);
return ret;
}
}
/* Result + error function */
- lua_settop (L, 0);
+ lua_settop (L, err_idx - 1);
if (skip) {
msg_info_task ("skip rule %s by condition callback",
}
lua_settable (L, -3); /* ret[rule->name] = {raw_fuzzy1, ..., raw_fuzzyn} */
- }
- g_ptr_array_free (commands, TRUE);
+ g_ptr_array_free (commands, TRUE);
+ }
}
}
else {