Skip to content

Commit 6d24fb5

Browse files
committed
Use ruby_xcalloc() instead of ruby_xmalloc() and memset()
1 parent f3d70b8 commit 6d24fb5

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

ext/fiddle/fiddle.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ static VALUE
1717
rb_fiddle_malloc(VALUE self, VALUE size)
1818
{
1919
void *ptr;
20-
size_t sizet = NUM2SIZET(size);
21-
ptr = (void*)ruby_xmalloc(sizet);
22-
memset(ptr, 0, sizet);
20+
ptr = (void*)ruby_xcalloc(1, NUM2SIZET(size));
2321
return PTR2NUM(ptr);
2422
}
2523

0 commit comments

Comments
 (0)