summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-05-31 23:01:04 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-05-31 23:01:04 +0900
commit7dbbd774076a99e7afc7e9b3ba27f9feac1bfa4b (patch)
treed6f010f893cb598c7b345f5e4d858a2edddf7f5b
parent877f9d02e6df8d21de7a53586155f757caab58d0 (diff)
downloadmruby-7dbbd774076a99e7afc7e9b3ba27f9feac1bfa4b.tar.gz
mruby-7dbbd774076a99e7afc7e9b3ba27f9feac1bfa4b.zip
Revert 4566c80; fix #3679
The patch deallocate the memory in `mrb_default_allocf` but that hinders GC in `mrb_realloc`.
-rw-r--r--src/state.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/state.c b/src/state.c
index a02e73f54..0be5a184a 100644
--- a/src/state.c
+++ b/src/state.c
@@ -52,13 +52,13 @@ mrb_open_core(mrb_allocf f, void *ud)
void*
mrb_default_allocf(mrb_state *mrb, void *p, size_t size, void *ud)
{
- void *p2;
-
- if (size == 0 || (p2 = realloc(p, size)) == NULL) {
+ if (size == 0) {
free(p);
return NULL;
}
- return p2;
+ else {
+ return realloc(p, size);
+ }
}
struct alloca_header {