~lbnz/xr0

0b1d75b87eddb90c6a9c64db06361ea6da0354e9 — Leibniz Founders 7 months ago e8f9e32
reduced leaks
2 files changed, 13 insertions(+), 12 deletions(-)

M src/ast/ast.c
M src/verify/verify.c
M src/ast/ast.c => src/ast/ast.c +3 -3
@@ 777,8 777,8 @@ ast_expr_eval(struct ast_expr *e)

	bool val = eval_prop(e1, e->u.binary.op, e2);

	math_expr_destroy(e1);
	math_expr_destroy(e2);
	math_expr_destroy(e1);

	return val;
}


@@ 828,8 828,8 @@ math_expr(struct ast_expr *e)
		);
	case EXPR_BINARY:
		return math_expr_sum_create(
			math_expr(ast_expr_copy(e->u.binary.e1)),
			binary_e2(ast_expr_copy(e->u.binary.e2), e->u.binary.op)
			math_expr(e->u.binary.e1),
			binary_e2(e->u.binary.e2, e->u.binary.op)
		);
	default:
		assert(false);

M src/verify/verify.c => src/verify/verify.c +10 -9
@@ 987,6 987,7 @@ expr_unary_eval(struct ast_expr *expr, struct state *state)
	assert(arr);
	struct object *obj = state_deref(state, arr, ast_expr_binary_e2(inner));
	assert(obj);
	result_destroy(res);

	struct value *v = object_as_value(obj);
	assert(v);


@@ 1001,14 1002,14 @@ expr_structmember_eval(struct ast_expr *expr, struct state *s)
	if (result_iserror(res)) {
		return res;
	}
	return result_value_create(
		object_as_value(
			value_struct_member(
				result_as_value(res),
				ast_expr_member_field(expr)
			)
	struct value *v = state_value_copy(object_as_value(
		value_struct_member(
			result_as_value(res),
			ast_expr_member_field(expr)
		)
	);
	));
	result_destroy(res);
	return result_value_create(v);
}

/* expr_call_eval */


@@ 1750,11 1751,9 @@ iter_absexec(struct ast_stmt *stmt, struct state *state)
	       result_up = expr_eval(up, state);

	if (result_iserror(result_lw)) {
		/*result_destroy(result_up);*/
		return result_lw;
	}
	if (result_iserror(result_up)) {
		/*result_destroy(result_lw);*/
		return result_up;
	}



@@ 1770,6 1769,8 @@ iter_absexec(struct ast_stmt *stmt, struct state *state)
		err = state_range_dealloc(state, obj, res_lw, res_up);
	}
	
	ast_expr_destroy(res_up);
	ast_expr_destroy(res_lw);
	state_object_destroy(obj);

	if (err) {