diff --git a/src/vm.c b/src/vm.c index ae8494ee..bc3c78bc 100644 --- a/src/vm.c +++ b/src/vm.c @@ -278,10 +278,14 @@ pic_run(pic_state *pic, struct pic_proc *proc, pic_value args) CASE(OP_LAMBDA) { struct pic_proc *proc; struct pic_env *env; + int i; env = (struct pic_env *)pic_obj_alloc(pic, sizeof(struct pic_env), PIC_TT_ENV); env->num_val = pic->irep[pc->u.i]->argc; env->values = (pic_value *)pic_alloc(pic, sizeof(pic_value) * env->num_val); + for (i = 0; i < env->num_val; ++i) { + env->values[i] = pic_undef_value(); + } env->up = pic_proc_ptr(*pic->ci->fp)->env; proc = pic_proc_new(pic, pic->irep[pc->u.i], env);