lua LCD fix

forgot to set new size after realloc

forgot to set sizelineinfo to 0 after free

Change-Id: Iaf7533aafaba1e2abf9599c9e1d0b75d913a8c36
This commit is contained in:
William Wilgus 2019-08-08 07:23:58 -05:00
parent d61ea6c5ee
commit 8d77ec88a5
2 changed files with 2 additions and 0 deletions

View file

@ -253,6 +253,7 @@ static int stripdebug (lua_State *L, Proto *f, const int level) {
case 3: case 3:
len += f->sizelineinfo; len += f->sizelineinfo;
f->packedlineinfo = luaM_freearray(L, f->packedlineinfo, f->sizelineinfo, unsigned char); f->packedlineinfo = luaM_freearray(L, f->packedlineinfo, f->sizelineinfo, unsigned char);
f->f->sizelineinfo = 0;
case 2: case 2:
len += f->sizelocvars * (sizeof(struct LocVar) + sizeof(dummy->tsv) + sizeof(struct LocVar *)); len += f->sizelocvars * (sizeof(struct LocVar) + sizeof(dummy->tsv) + sizeof(struct LocVar *));
f->locvars = luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar); f->locvars = luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar);

View file

@ -370,6 +370,7 @@ static void close_func (LexState *ls) {
f->packedlineinfo[fs->lastlineOffset+1]=0; f->packedlineinfo[fs->lastlineOffset+1]=0;
luaM_reallocvector(L, f->packedlineinfo, f->sizelineinfo, luaM_reallocvector(L, f->packedlineinfo, f->sizelineinfo,
fs->lastlineOffset+2, unsigned char); fs->lastlineOffset+2, unsigned char);
f->sizelineinfo = fs->lastlineOffset + 2;
#else #else
luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int); luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int);
f->sizelineinfo = fs->pc; f->sizelineinfo = fs->pc;