From 006c73b47a7d43bff3ea7b51eca81527b02ec589 Mon Sep 17 00:00:00 2001 From: Charlotte Meyer Date: Tue, 31 Dec 2019 00:25:20 +0000 Subject: [PATCH] Fix callback leak --- kiwmi/luak.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kiwmi/luak.c b/kiwmi/luak.c index ff6125d..8cde5f8 100644 --- a/kiwmi/luak.c +++ b/kiwmi/luak.c @@ -37,6 +37,8 @@ l_lua_callback_cancel(lua_State *L) wl_list_remove(&lc->listener.link); wl_list_remove(&lc->link); + luaL_unref(L, LUA_REGISTRYINDEX, lc->callback_ref); + free(lc); return 0; @@ -300,6 +302,8 @@ luaK_fini(struct kiwmi_lua *lua) wl_list_remove(&lc->listener.link); wl_list_remove(&lc->link); + luaL_unref(lua->L, LUA_REGISTRYINDEX, lc->callback_ref); + free(lc); }