Bugfix a leak?

This commit is contained in:
2023-02-28 17:37:43 +11:00
parent 12fa434e0f
commit 70ca27486e

View File

@@ -1767,8 +1767,9 @@ static bool execIndexAssign(Toy_Interpreter* interpreter) {
assign = Toy_popLiteralArray(&interpreter->stack); assign = Toy_popLiteralArray(&interpreter->stack);
} }
else { else {
compound = result; //no free compound = result;
Toy_freeLiteral(result);
//suppress the extra assign value //suppress the extra assign value
Toy_Literal tmp = Toy_popLiteralArray(&interpreter->stack); Toy_Literal tmp = Toy_popLiteralArray(&interpreter->stack);
Toy_freeLiteral(tmp); Toy_freeLiteral(tmp);
@@ -1780,6 +1781,10 @@ static bool execIndexAssign(Toy_Interpreter* interpreter) {
compound = Toy_popLiteralArray(&interpreter->stack); compound = Toy_popLiteralArray(&interpreter->stack);
if (TOY_IS_IDENTIFIER(compound)) { if (TOY_IS_IDENTIFIER(compound)) {
if (freeIdn) {
Toy_freeLiteral(compoundIdn);
}
compoundIdn = compound; compoundIdn = compound;
Toy_parseIdentifierToValue(interpreter, &compound); Toy_parseIdentifierToValue(interpreter, &compound);
freeIdn = true; freeIdn = true;