one more protection against Lua stack leak

This commit is contained in:
Kartik K. Agaram 2021-12-17 21:58:56 -08:00
parent 92fe487349
commit c12ba48a63
1 changed files with 6 additions and 6 deletions

View File

@ -765,7 +765,7 @@ static void big_picture_menu (void) {
static int is_current_definition(lua_State *L, const char *definition_name, int current_history_array_index, int history_array_location, int history_array_size) {
/* Sequentially scan back through history_array until current_history_array_index.
* Is there an earlier definition of definition_name? */
//? int oldsize = L->top-L->stack;
int oldtop = lua_gettop(L);
int found = 0;
for (int i = history_array_size; i > current_history_array_index; --i) {
lua_rawgeti(L, history_array_location, i);
@ -784,11 +784,11 @@ static int is_current_definition(lua_State *L, const char *definition_name, int
if (found)
break;
}
//? if(oldsize != L->top-L->stack) {
//? endwin();
//? printf("%d %d\n", oldsize, L->top-L->stack);
//? exit(1);
//? }
if(oldtop != lua_gettop(L)) {
endwin();
printf("%d %d\n", oldtop, lua_gettop(L));
exit(1);
}
return !found;
}