aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lstate.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/lstate.c b/lstate.c
index 5049c753..a50252bc 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.c,v 1.31 2000/08/08 20:42:07 roberto Exp roberto $ 2** $Id: lstate.c,v 1.32 2000/08/09 19:16:57 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -70,7 +70,9 @@ lua_State *lua_newstate (int stacksize, int put_builtin) {
70} 70}
71 71
72 72
73#ifdef DEBUG
73extern lua_State *lua_state; 74extern lua_State *lua_state;
75#endif
74 76
75void lua_close (lua_State *L) { 77void lua_close (lua_State *L) {
76 luaC_collect(L, 1); /* collect all elements */ 78 luaC_collect(L, 1); /* collect all elements */
@@ -86,10 +88,7 @@ void lua_close (lua_State *L) {
86 LUA_ASSERT(L->numCblocks == 0, "Cblocks still open"); 88 LUA_ASSERT(L->numCblocks == 0, "Cblocks still open");
87 LUA_ASSERT(L->nblocks == 0, "wrong count for nblocks"); 89 LUA_ASSERT(L->nblocks == 0, "wrong count for nblocks");
88 luaM_free(L, L); 90 luaM_free(L, L);
89 if (L == lua_state) { 91 LUA_ASSERT(L != lua_state || memdebug_numblocks == 0, "memory leak!");
90 LUA_ASSERT(memdebug_numblocks == 0, "memory leak!"); 92 LUA_ASSERT(L != lua_state || memdebug_total == 0,"memory leak!");
91 LUA_ASSERT(memdebug_total == 0,"memory leak!");
92 lua_state = NULL;
93 }
94} 93}
95 94