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

[ruby/fiddle] Use ruby_xcalloc() instead of ruby_xmalloc() and memset()

https://github.com/ruby/fiddle/commit/6d24fb5438
This commit is contained in:
Sutou Kouhei 2020-11-17 06:04:00 +09:00 committed by Sutou Kouhei
parent 1867088d90
commit e27701291a
Notes: git 2020-11-18 09:05:45 +09:00

View file

@ -17,9 +17,7 @@ static VALUE
rb_fiddle_malloc(VALUE self, VALUE size)
{
void *ptr;
size_t sizet = NUM2SIZET(size);
ptr = (void*)ruby_xmalloc(sizet);
memset(ptr, 0, sizet);
ptr = (void*)ruby_xcalloc(1, NUM2SIZET(size));
return PTR2NUM(ptr);
}