aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_cfg_file.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-08-12 16:53:14 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-08-12 16:53:14 +0400
commit0b01a138daf4e83bd37750c7574b8c7dbef68f19 (patch)
treea9ee6975d837a86d27834e01faec9e062d50344e /src/lua/lua_cfg_file.c
parent45e3f01ca7f3487893b49ebea044ae73a1048123 (diff)
downloadrspamd-0b01a138daf4e83bd37750c7574b8c7dbef68f19.tar.gz
rspamd-0b01a138daf4e83bd37750c7574b8c7dbef68f19.zip
Fix critical bug with lua stack cleaning that caused heavy memory leaks.0.4.3
Update to 0.4.3.
Diffstat (limited to 'src/lua/lua_cfg_file.c')
-rw-r--r--src/lua/lua_cfg_file.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lua/lua_cfg_file.c b/src/lua/lua_cfg_file.c
index a7f023cb3..b63e6d985 100644
--- a/src/lua/lua_cfg_file.c
+++ b/src/lua/lua_cfg_file.c
@@ -396,32 +396,39 @@ lua_handle_param (struct worker_task *task, gchar *mname, gchar *optname, enum l
switch (expected_type) {
case LUA_VAR_NUM:
if (!lua_isnumber (L, -1)) {
+ lua_pop (L, 1);
*res = NULL;
return FALSE;
}
num_res = lua_tonumber (L, -1);
*res = memory_pool_alloc (task->task_pool, sizeof (double));
**(double **)res = num_res;
+ lua_pop (L, 1);
return TRUE;
case LUA_VAR_BOOLEAN:
if (!lua_isboolean (L, -1)) {
+ lua_pop (L, 1);
*res = NULL;
return FALSE;
}
bool_res = lua_toboolean (L, -1);
*res = memory_pool_alloc (task->task_pool, sizeof (gboolean));
**(gboolean **)res = bool_res;
+ lua_pop (L, 1);
return TRUE;
case LUA_VAR_STRING:
if (!lua_isstring (L, -1)) {
+ lua_pop (L, 1);
*res = NULL;
return FALSE;
}
str_res = memory_pool_strdup (task->task_pool, lua_tostring (L, -1));
*res = str_res;
+ lua_pop (L, 1);
return TRUE;
case LUA_VAR_FUNCTION:
case LUA_VAR_UNKNOWN:
+ lua_pop (L, 1);
msg_err ("cannot expect function or unknown types");
*res = NULL;
return FALSE;