Unverified Commit 6ad89d30 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

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

Fix wrong size of instance variable if occur out of memory
parents e74a8a73 d8527d17
...@@ -79,19 +79,19 @@ iv_put(mrb_state *mrb, iv_tbl *t, mrb_sym sym, mrb_value val) ...@@ -79,19 +79,19 @@ iv_put(mrb_state *mrb, iv_tbl *t, mrb_sym sym, mrb_value val)
} }
/* Not found */ /* Not found */
t->size++;
if (matched_seg) { if (matched_seg) {
matched_seg->key[matched_idx] = sym; matched_seg->key[matched_idx] = sym;
matched_seg->val[matched_idx] = val; matched_seg->val[matched_idx] = val;
t->size++;
return; return;
} }
seg = (segment*)mrb_malloc(mrb, sizeof(segment)); seg = (segment*)mrb_malloc(mrb, sizeof(segment));
if (!seg) return;
seg->next = NULL; seg->next = NULL;
seg->key[0] = sym; seg->key[0] = sym;
seg->val[0] = val; seg->val[0] = val;
t->last_len = 1; t->last_len = 1;
t->size++;
if (prev) { if (prev) {
prev->next = seg; prev->next = seg;
} }
......
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