diff options
author | Xiongfei Guo <xfguo@credosemi.com> | 2014-06-20 14:31:20 +0400 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2014-06-24 17:30:30 +0400 |
commit | 3c92274bee9f6e3a67c1103467e019f96b78b267 (patch) | |
tree | 7d4f1e55582a844a892193ff536a0cfbe1d1f316 /lua | |
parent | 02ca59334743aff65a24cba16c9343412c2c0550 (diff) |
Fix bug of unref resources in Lua binding; fd method delete -> cancel.
Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
Diffstat (limited to 'lua')
-rw-r--r-- | lua/uloop.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lua/uloop.c b/lua/uloop.c index df57b8a..89ce60c 100644 --- a/lua/uloop.c +++ b/lua/uloop.c @@ -80,7 +80,7 @@ static int ul_timer_free(lua_State *L) uloop_timeout_cancel(&tout->t); lua_getglobal(state, "__uloop_cb"); - luaL_unref(L, -1, tout->r); + luaL_unref(state, -1, tout->r); return 1; } @@ -177,10 +177,14 @@ static int ul_ufd_delete(lua_State *L) struct lua_uloop_fd *ufd = lua_touserdata(L, 1); uloop_fd_delete(&ufd->fd); + lua_getglobal(state, "__uloop_cb"); - luaL_unref(L, -1, ufd->r); + luaL_unref(state, -1, ufd->r); + lua_remove(state, -1); + lua_getglobal(state, "__uloop_fds"); - luaL_unref(L, -1, ufd->fd_r); + luaL_unref(state, -1, ufd->fd_r); + lua_remove(state, -1); return 1; } |