summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/proc.c b/proc.c
index 3e7c297..44ec281 100644
--- a/proc.c
+++ b/proc.c
@@ -2510,16 +2510,15 @@ proc_binding(VALUE self)
if (iseq && env->local_size < iseq->local_size) {
int prev_local_size = env->local_size;
int local_size = iseq->local_size;
- rb_env_t *newenv;
- VALUE newenvval;
- newenv = xmalloc(sizeof(rb_env_t) + ((local_size + 1) * sizeof(VALUE)));
+ VALUE newenvval = TypedData_Wrap_Struct(RBASIC_CLASS(envval), RTYPEDDATA_TYPE(envval), 0);
+ rb_env_t *newenv = xmalloc(sizeof(rb_env_t) + ((local_size + 1) * sizeof(VALUE)));
+ RTYPEDDATA_DATA(newenvval) = newenv;
newenv->env_size = local_size + 2;
newenv->local_size = local_size;
newenv->prev_envval = env->prev_envval;
newenv->block = env->block;
MEMCPY(newenv->env, env->env, VALUE, prev_local_size + 1);
rb_mem_clear(newenv->env + prev_local_size + 1, local_size - prev_local_size);
- newenvval = TypedData_Wrap_Struct(RBASIC_CLASS(envval), RTYPEDDATA_TYPE(envval), newenv);
newenv->env[local_size + 1] = newenvval;
envval = newenvval;
}