diff options
| author | Hiroshi Mimaki <[email protected]> | 2020-06-30 18:33:47 +0900 |
|---|---|---|
| committer | Hiroshi Mimaki <[email protected]> | 2020-06-30 18:33:47 +0900 |
| commit | aa578c346db6058801a2b64781a50fab9ed1f74b (patch) | |
| tree | f3063cc0a7678348b094a7124969a5eafd20c6ba | |
| parent | ac8360003ecfa1ec21295533c9213f17fd8e39bb (diff) | |
| download | mruby-aa578c346db6058801a2b64781a50fab9ed1f74b.tar.gz mruby-aa578c346db6058801a2b64781a50fab9ed1f74b.zip | |
Revert "Free the original pointer if `realloc` failed."
This reverts commit 9cdf439db52b66447b4e37c61179d54fad6c8f33.
| -rw-r--r-- | src/gc.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -225,9 +225,14 @@ mrb_realloc(mrb_state *mrb, void *p, size_t len) p2 = mrb_realloc_simple(mrb, p, len); if (len == 0) return p2; if (p2 == NULL) { - mrb_free(mrb, p); - mrb->gc.out_of_memory = TRUE; - mrb_raise_nomemory(mrb); + if (mrb->gc.out_of_memory) { + mrb_raise_nomemory(mrb); + /* mrb_panic(mrb); */ + } + else { + mrb->gc.out_of_memory = TRUE; + mrb_raise_nomemory(mrb); + } } else { mrb->gc.out_of_memory = FALSE; |
