diff --git a/src/variable.c b/src/variable.c index bce6e0ef3..1130b7aaf 100644 --- a/src/variable.c +++ b/src/variable.c @@ -48,6 +48,7 @@ iv_rehash(mrb_state *mrb, iv_tbl *t) t->alloc = new_alloc; t->size = 0; t->ptr = (mrb_value*)mrb_calloc(mrb, sizeof(mrb_value)+sizeof(mrb_sym), new_alloc); + if (old_alloc == 0) return; mrb_sym *keys = (mrb_sym*)&old_ptr[old_alloc]; mrb_value *vals = old_ptr;