Merge pull request #4377 from dearblue/wrong-iv-size

Fix wrong size of instance variable if occur out of memory
This commit is contained in:
Yukihiro "Matz" Matsumoto
2019-04-14 20:36:05 +09:00
committed by GitHub
+2 -2
View File
@@ -79,19 +79,19 @@ iv_put(mrb_state *mrb, iv_tbl *t, mrb_sym sym, mrb_value val)
}
/* Not found */
t->size++;
if (matched_seg) {
matched_seg->key[matched_idx] = sym;
matched_seg->val[matched_idx] = val;
t->size++;
return;
}
seg = (segment*)mrb_malloc(mrb, sizeof(segment));
if (!seg) return;
seg->next = NULL;
seg->key[0] = sym;
seg->val[0] = val;
t->last_len = 1;
t->size++;
if (prev) {
prev->next = seg;
}