mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
[ruby/fiddle] Initialize memory to 0 when calling Fiddle.malloc(). (#24)
https://github.com/ruby/fiddle/commit/8414239ca3
This commit is contained in:
parent
ad729a1d11
commit
aa1d3c7d2c
Notes:
git
2020-05-23 14:29:43 +09:00
@ -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);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user