diff options
author | sinisterchipmunk <sinisterchipmunk@gmail.com> | 2020-01-22 02:30:22 -0500 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-05-23 14:29:16 +0900 |
commit | aa1d3c7d2c020ec927acaa487e8593172fb64bb0 (patch) | |
tree | d78113cbad13af8f098f32d9e7601d58d039f1ee | |
parent | ad729a1d11c6c57efd2e92803b4e937db0f75252 (diff) | |
download | ruby-aa1d3c7d2c020ec927acaa487e8593172fb64bb0.tar.gz |
[ruby/fiddle] Initialize memory to 0 when calling Fiddle.malloc(). (#24)
https://github.com/ruby/fiddle/commit/8414239ca3
-rw-r--r-- | ext/fiddle/fiddle.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/fiddle/fiddle.c b/ext/fiddle/fiddle.c index 9f3d1537d6..bb6b1070d3 100644 --- a/ext/fiddle/fiddle.c +++ b/ext/fiddle/fiddle.c @@ -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); } |