diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-05-31 23:02:59 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-05-31 23:02:59 +0900 |
| commit | b4a4e3c09abf2e9f790d465539b63e9aa82baa05 (patch) | |
| tree | dbb56443132695a5fad5dcf9f1e78ff01fa6b381 /src/gc.c | |
| parent | 7dbbd774076a99e7afc7e9b3ba27f9feac1bfa4b (diff) | |
| download | mruby-b4a4e3c09abf2e9f790d465539b63e9aa82baa05.tar.gz mruby-b4a4e3c09abf2e9f790d465539b63e9aa82baa05.zip | |
Simplify the logic in `mrb_realloc`; ref #3679
Diffstat (limited to 'src/gc.c')
| -rw-r--r-- | src/gc.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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); */ |
