free nested environment in codegen
This commit is contained in:
parent
4e83ad4843
commit
0ccff2f626
3
src/vm.c
3
src/vm.c
|
@ -85,7 +85,7 @@ env_new(pic_state *pic, pic_value args, struct pic_env *env)
|
||||||
struct pic_pair *cell;
|
struct pic_pair *cell;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
inner_env = (struct pic_env *)malloc(sizeof(struct pic_env));
|
inner_env = (struct pic_env *)pic_alloc(pic, sizeof(struct pic_env));
|
||||||
inner_env->assoc = pic_nil_value();
|
inner_env->assoc = pic_nil_value();
|
||||||
inner_env->parent = env;
|
inner_env->parent = env;
|
||||||
|
|
||||||
|
@ -420,6 +420,7 @@ pic_gen_lambda(pic_state *pic, pic_value obj, struct pic_env *env)
|
||||||
}
|
}
|
||||||
irep->code[irep->clen].insn = OP_RET;
|
irep->code[irep->clen].insn = OP_RET;
|
||||||
irep->clen++;
|
irep->clen++;
|
||||||
|
pic_free(pic, inner_env);
|
||||||
|
|
||||||
#if VM_DEBUG
|
#if VM_DEBUG
|
||||||
printf("LAMBDA_%d:\n", pic->ilen);
|
printf("LAMBDA_%d:\n", pic->ilen);
|
||||||
|
|
Loading…
Reference in New Issue