Could you please try this patch? Thanks. luaM_freearray(L, f->lineinfo, f->sizelineinfo); f->lineinfo = NULL; /* add this line */ f->sizelineinfo = 0;