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

[ruby/fiddle] Initialize memory to 0 when calling Fiddle.malloc(). (#24)

https://github.com/ruby/fiddle/commit/8414239ca3
This commit is contained in:
sinisterchipmunk 2020-01-22 02:30:22 -05:00 committed by Nobuyoshi Nakada
parent ad729a1d11
commit aa1d3c7d2c
Notes: git 2020-05-23 14:29:43 +09:00

View file

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