diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-03-30 15:38:24 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-03-30 15:38:24 -0300 |
commit | a274596ecc6edc4a8f2377943ee86fac6ff80acc (patch) | |
tree | 60e72c86011d6a2338b47521c497d2251b940e57 | |
parent | 7e9bc41fe7539212165975478e2678e0ec9644c7 (diff) | |
download | lua-a274596ecc6edc4a8f2377943ee86fac6ff80acc.tar.gz lua-a274596ecc6edc4a8f2377943ee86fac6ff80acc.tar.bz2 lua-a274596ecc6edc4a8f2377943ee86fac6ff80acc.zip |
avoid making 'lastfree' an invalid pointer
-rw-r--r-- | ltable.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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 | ||
378 | static Node *getfreepos (Table *t) { | 378 | static 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 | } |