summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMateusz Gozdek <mgozdekof@gmail.com>2021-04-04 21:07:30 +0200
committerPatrick <tingping@tingping.se>2021-04-04 21:17:05 -0500
commit90c91d6c9aa048eff8f8f8f888d37a21fd714522 (patch)
tree60fdd25201b4626fdbf96d1f4e2c7d7ccb67eee3
parent090fd29acf4af0d8e13fcf2861b14a356db72641 (diff)
plugins/lua/lua.c: fix segfault on lua_pop with Lua 5.4.3
Closes #2558

Co-authored-by: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
-rw-r--r--plugins/lua/lua.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/lua/lua.c b/plugins/lua/lua.c
index d73fbb23..d1370eaf 100644
--- a/plugins/lua/lua.c
+++ b/plugins/lua/lua.c
@@ -1189,11 +1189,11 @@ static void patch_clibs(lua_State *L)
 		if(lua_type(L, -2) == LUA_TLIGHTUSERDATA && lua_type(L, -1) == LUA_TTABLE)
 		{
 			lua_setfield(L, LUA_REGISTRYINDEX, "_CLIBS");
+			lua_pop(L, 1);
 			break;
 		}
 		lua_pop(L, 1);
 	}
-	lua_pop(L, 1);
 }
 
 static GPtrArray *scripts;