Skip to content

Commit

Permalink
Revert 4566c80; fix #3679
Browse files Browse the repository at this point in the history
The patch deallocate the memory in `mrb_default_allocf` but that
hinders GC in `mrb_realloc`.
  • Loading branch information
matz committed May 31, 2017
1 parent 877f9d0 commit 7dbbd77
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7dbbd77

Please sign in to comment.