From c23f7053495934bc7fbce7328af1e7f03f248de1 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 30 Aug 2013 12:49:41 -0300 Subject: BUG: GC can collect a long string still in use during parser --- llex.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'llex.c') diff --git a/llex.c b/llex.c index 1a32e348..b1a714fa 100644 --- a/llex.c +++ b/llex.c @@ -1,5 +1,5 @@ /* -** $Id: llex.c,v 2.63 2013/03/16 21:10:18 roberto Exp $ +** $Id: llex.c,v 2.63.1.1 2013/04/12 18:48:47 roberto Exp roberto $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -133,6 +133,9 @@ TString *luaX_newstring (LexState *ls, const char *str, size_t l) { setbvalue(o, 1); /* t[string] = true */ luaC_checkGC(L); } + else { /* string already present */ + ts = rawtsvalue(keyfromval(o)); /* re-use value previously stored */ + } L->top--; /* remove string from stack */ return ts; } -- cgit v1.2.3-55-g6feb