1/ when a variable declared in a loop was re-initialized, we didn't free
the old value before allocating a new one.
2/ When assigning to an out-of-bounds array index, created an rval,
but never freed it.
Signed-off-by: NeilBrown <neil@brown.name>
bools[1] = strings[2] <= "there"
for i:=0; then i=i+1; while i<5:
- print '', bools[i],
+ j ::= i
+ ra:[5]number
+ ra[i-1] = i*i
+ ra[6] = 42 // mustn't crash
+ print '', bools[i], ra[j-1],
print
###### output: arrays
- False True False False False
+ False 0 True 1 False 4 False 9 False 16
## Structures
{
struct lrval ret = _interp_exec(e);
- if (typeret)
+ if (ret.lval)
*typeret = ret.type;
+ else
+ free_value(ret.type, &ret.rval);
return ret.lval;
}
rtype = Tnone;
} else {
free_value(v->type, v->val);
+ free(v->val);
v->val = val_alloc(v->type, NULL);
}
break;