summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-12-03 15:04:14 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-12-03 15:04:14 +0900
commita20c2a08abf48099f38d16f103312aad12c6999b (patch)
treee0b281388f9358d79f967eceae1fb14fbdf20a6a /src
parent6ac26e44429313c6bb58015028c61468e391f700 (diff)
downloadmruby-a20c2a08abf48099f38d16f103312aad12c6999b.tar.gz
mruby-a20c2a08abf48099f38d16f103312aad12c6999b.zip
variable.c: should not access `NULL[0]` to avoid asan warnings.
Diffstat (limited to 'src')
-rw-r--r--src/variable.c1
1 files changed, 1 insertions, 0 deletions
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;