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

This commit is contained in:
Yukihiro "Matz" Matsumoto
2021-12-03 15:04:14 +09:00
parent 6ac26e4442
commit a20c2a08ab
+1
View File
@@ -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;