Skip to content

Commit

Permalink
[ruby/fiddle] Initialize memory to 0 when calling Fiddle.malloc(). (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
sinisterchipmunk authored and nobu committed May 23, 2020
1 parent ad729a1 commit aa1d3c7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ext/fiddle/fiddle.c
Expand Up @@ -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);
}

Expand Down

0 comments on commit aa1d3c7

Please sign in to comment.