aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-03-30 15:38:24 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-03-30 15:38:24 -0300
commita274596ecc6edc4a8f2377943ee86fac6ff80acc (patch)
tree60e72c86011d6a2338b47521c497d2251b940e57
parent7e9bc41fe7539212165975478e2678e0ec9644c7 (diff)
downloadlua-a274596ecc6edc4a8f2377943ee86fac6ff80acc.tar.gz
lua-a274596ecc6edc4a8f2377943ee86fac6ff80acc.tar.bz2
lua-a274596ecc6edc4a8f2377943ee86fac6ff80acc.zip
avoid making 'lastfree' an invalid pointer
-rw-r--r--ltable.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ltable.c b/ltable.c
index a92b58ca..22419283 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 2.37 2007/04/18 19:24:35 roberto Exp roberto $ 2** $Id: ltable.c,v 2.38 2008/01/30 18:05:23 roberto Exp roberto $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -376,7 +376,8 @@ void luaH_free (lua_State *L, Table *t) {
376 376
377 377
378static Node *getfreepos (Table *t) { 378static Node *getfreepos (Table *t) {
379 while (t->lastfree-- > t->node) { 379 while (t->lastfree > t->node) {
380 t->lastfree--;
380 if (ttisnil(gkey(t->lastfree))) 381 if (ttisnil(gkey(t->lastfree)))
381 return t->lastfree; 382 return t->lastfree;
382 } 383 }