lua

A copy of the Lua development repository
Log | Files | Refs | README

commit a274596ecc6edc4a8f2377943ee86fac6ff80acc
parent 7e9bc41fe7539212165975478e2678e0ec9644c7
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Mon, 30 Mar 2009 15:38:00 -0300

avoid making 'lastfree' an invalid pointer

Diffstat:
Mltable.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ltable.c b/ltable.c @@ -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; }