mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 04:30:06 +01:00
lua: add missing lua_pop for the evdev frame
Where a plugin returns a table to be processed we never popped that table from the stack. Eventually this would lead to the plugin failing as the stack size is exceeded. Fixes #1195 Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1323>
This commit is contained in:
parent
aa7d58005e
commit
3250686e70
1 changed files with 6 additions and 5 deletions
|
|
@ -226,15 +226,14 @@ lua_pop_evdev_frame(struct libinput_lua_plugin *plugin, struct evdev_frame *fram
|
|||
lua_State *L = plugin->L;
|
||||
|
||||
if (lua_isnil(L, -1)) {
|
||||
lua_pop(L, 1);
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!lua_istable(L, -1)) {
|
||||
plugin_log_bug(plugin->parent,
|
||||
"expected table like `{ events = { ... } }`, got %s",
|
||||
lua_typename(L, lua_type(L, -1)));
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
struct evdev_event events[64] = { 0 };
|
||||
|
|
@ -249,8 +248,7 @@ lua_pop_evdev_frame(struct libinput_lua_plugin *plugin, struct evdev_frame *fram
|
|||
plugin->parent,
|
||||
"expected table like `{ type = ..., code = ...}`, got %s",
|
||||
lua_typename(L, lua_type(L, -1)));
|
||||
lua_pop(L, 1);
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
lua_getfield(L, -1, "usage");
|
||||
|
|
@ -282,6 +280,9 @@ lua_pop_evdev_frame(struct libinput_lua_plugin *plugin, struct evdev_frame *fram
|
|||
if (evdev_frame_set(frame_out, events, nevents) == -ENOMEM) {
|
||||
plugin_log_bug(plugin->parent, "too many events in frame");
|
||||
}
|
||||
|
||||
out:
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue