diff --git a/imemo.c b/imemo.c index 8b3018523f..d949466a77 100644 --- a/imemo.c +++ b/imemo.c @@ -94,8 +94,9 @@ rb_free_tmp_buffer(volatile VALUE *store) rb_imemo_tmpbuf_t *s = (rb_imemo_tmpbuf_t*)ATOMIC_VALUE_EXCHANGE(*store, 0); if (s) { void *ptr = ATOMIC_PTR_EXCHANGE(s->ptr, 0); + long cnt = s->cnt; s->cnt = 0; - ruby_xfree(ptr); + ruby_sized_xfree(ptr, sizeof(VALUE) * cnt); } }