avoid making 'lastfree' an invalid pointer

This commit is contained in:
Roberto Ierusalimschy 2009-03-30 15:38:24 -03:00
parent 7e9bc41fe7
commit a274596ecc
1 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/*
** $Id: ltable.c,v 2.37 2007/04/18 19:24:35 roberto Exp roberto $
** $Id: ltable.c,v 2.38 2008/01/30 18:05:23 roberto Exp roberto $
** Lua tables (hash)
** See Copyright Notice in lua.h
*/
@ -376,7 +376,8 @@ void luaH_free (lua_State *L, Table *t) {
static Node *getfreepos (Table *t) {
while (t->lastfree-- > t->node) {
while (t->lastfree > t->node) {
t->lastfree--;
if (ttisnil(gkey(t->lastfree)))
return t->lastfree;
}