소스 검색

Fix Lua websocket stack overflow error

lua_pushlightuserdata() pushes a value onto the Lua stack, which has to be popped. Otherwise the stack fills up with every websocket timer callback.
k-mds 6 년 전
부모
커밋
01a0f4fa2d
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      src/mod_lua.inl

+ 1 - 0
src/mod_lua.inl

@@ -1778,6 +1778,7 @@ lua_action(struct laction_arg *arg)
 	lua_pushlightuserdata(arg->state, (void *)&lua_regkey_ctx);
 	lua_pushlightuserdata(arg->state, (void *)&lua_regkey_ctx);
 	lua_gettable(arg->state, LUA_REGISTRYINDEX);
 	lua_gettable(arg->state, LUA_REGISTRYINDEX);
 	ctx = (struct mg_context *)lua_touserdata(arg->state, -1);
 	ctx = (struct mg_context *)lua_touserdata(arg->state, -1);
+	lua_pop(arg->state, 1);
 
 
 	err = luaL_loadstring(arg->state, arg->txt);
 	err = luaL_loadstring(arg->state, arg->txt);
 	if (err != 0) {
 	if (err != 0) {