Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorXiongfei Guo <xfguo@credosemi.com>2014-06-20 14:31:17 +0400
committerJohn Crispin <blogic@openwrt.org>2014-06-24 17:30:30 +0400
commit9565bf86ae48c47c744467e30b2219cf9cd70fbf (patch)
tree67df96537128c7294b69c968b9baf62667a0dc0e /lua
parente130b08d98d59dae5d0c59210aeb7633c011b107 (diff)
Fix stack overflow bug of uloop lua binding.
The static variable `state` in `lua/uloop.c` should be clean after every callback. Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
Diffstat (limited to 'lua')
-rw-r--r--lua/uloop.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lua/uloop.c b/lua/uloop.c
index 51f53c2..5922e04 100644
--- a/lua/uloop.c
+++ b/lua/uloop.c
@@ -43,6 +43,7 @@ static void ul_timer_cb(struct uloop_timeout *t)
lua_getglobal(state, "__uloop_cb");
lua_rawgeti(state, -1, tout->r);
+ lua_remove(state, -2);
lua_call(state, 0, 0);
}
@@ -133,6 +134,7 @@ static void ul_process_cb(struct uloop_process *p, int ret)
lua_getglobal(state, "__uloop_cb");
lua_rawgeti(state, -1, proc->r);
luaL_unref(state, -2, proc->r);
+ lua_remove(state, -2);
lua_pushinteger(state, ret >> 8);
lua_call(state, 1, 0);
}