Skip to content

Commit

Permalink
Simplify the logic in mrb_realloc; ref #3679
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed May 31, 2017
1 parent 7dbbd77 commit b4a4e3c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/gc.c
Expand Up @@ -215,7 +215,8 @@ mrb_realloc(mrb_state *mrb, void *p, size_t len)
void *p2; void *p2;


p2 = mrb_realloc_simple(mrb, p, len); p2 = mrb_realloc_simple(mrb, p, len);
if (!p2 && len) { if (len == 0) return p2;
if (p2 == NULL) {
if (mrb->gc.out_of_memory) { if (mrb->gc.out_of_memory) {
mrb_exc_raise(mrb, mrb_obj_value(mrb->nomem_err)); mrb_exc_raise(mrb, mrb_obj_value(mrb->nomem_err));
/* mrb_panic(mrb); */ /* mrb_panic(mrb); */
Expand Down

0 comments on commit b4a4e3c

Please sign in to comment.