variable.c: should not access `NULL[0]` to avoid asan warnings.

parent 6ac26e44
...@@ -48,6 +48,7 @@ iv_rehash(mrb_state *mrb, iv_tbl *t) ...@@ -48,6 +48,7 @@ iv_rehash(mrb_state *mrb, iv_tbl *t)
t->alloc = new_alloc; t->alloc = new_alloc;
t->size = 0; t->size = 0;
t->ptr = (mrb_value*)mrb_calloc(mrb, sizeof(mrb_value)+sizeof(mrb_sym), new_alloc); 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_sym *keys = (mrb_sym*)&old_ptr[old_alloc];
mrb_value *vals = old_ptr; mrb_value *vals = old_ptr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment