1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

fix size of allocated memory

The size of `ptr` here is not the same as the variable `size`.
We were counting the size of header twice.
This commit is contained in:
Urabe, Shyouhei 2019-04-24 12:24:44 +09:00
parent 6201a89b38
commit b11b26bcaf

View file

@ -408,7 +408,7 @@ rb_transient_heap_alloc(VALUE obj, size_t req_size)
RB_DEBUG_COUNTER_INC(theap_alloc); RB_DEBUG_COUNTER_INC(theap_alloc);
/* ptr is set up; OK to unpoison. */ /* ptr is set up; OK to unpoison. */
unpoison_memory_region(ptr, size, true); unpoison_memory_region(ptr, size - sizeof *header, true);
return ptr; return ptr;
} }
else { else {