Simplify the logic in `mrb_realloc`; ref #3679

parent 7dbbd774
......@@ -215,7 +215,8 @@ mrb_realloc(mrb_state *mrb, void *p, size_t len)
void *p2;
p2 = mrb_realloc_simple(mrb, p, len);
if (!p2 && len) {
if (len == 0) return p2;
if (p2 == NULL) {
if (mrb->gc.out_of_memory) {
mrb_exc_raise(mrb, mrb_obj_value(mrb->nomem_err));
/* mrb_panic(mrb); */
......
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