[OpenWrt-Devel] [PATCH 1/2 ubus] lua: Fix stack imbalance in ubus_event_handler
Hans Dedecker
dedeckeh at gmail.com
Mon Nov 2 05:16:10 EST 2015
The value from getglobal wasn't being removed from the stack,
resulting in an ever growing stack in the ubus event handler.
Signed-off-by: Karl Vogel <karl.vogel at gmail.com>
Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
lua/ubus.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lua/ubus.c b/lua/ubus.c
index a48fb7d..2903e7b 100644
--- a/lua/ubus.c
+++ b/lua/ubus.c
@@ -597,10 +597,13 @@ ubus_event_handler(struct ubus_context *ctx, struct ubus_event_handler *ev,
lua_getglobal(state, "__ubus_cb_event");
lua_rawgeti(state, -1, listener->r);
+ lua_remove(state, -2);
if (lua_isfunction(state, -1)) {
ubus_lua_parse_blob_array(state, blob_data(msg), blob_len(msg), true);
lua_call(state, 1, 0);
+ } else {
+ lua_pop(state, 1);
}
}
--
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list