Skip to content

Commit

Permalink
Fix Lua state usage after closing it in sb_lua_close_state().
Browse files Browse the repository at this point in the history
  • Loading branch information
akopytov committed Apr 1, 2018
1 parent a4cb8a6 commit b316938
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/sb_lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,9 +828,6 @@ int sb_lua_close_state(lua_State *state)
{
sb_lua_ctxt_t * const ctxt = &tls_lua_ctxt;

if (state != NULL)
lua_close(state);

if (ctxt != NULL)
{
sb_lua_db_disconnect(state);
Expand All @@ -842,6 +839,9 @@ int sb_lua_close_state(lua_State *state)
}
}

if (state != NULL)
lua_close(state);

ctxt->L = NULL;

return 0;
Expand Down

0 comments on commit b316938

Please sign in to comment.