diff options
Diffstat (limited to 'ext/fiddle/closure.c')
-rw-r--r-- | ext/fiddle/closure.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/fiddle/closure.c b/ext/fiddle/closure.c index 21796660c4..a1413206fd 100644 --- a/ext/fiddle/closure.c +++ b/ext/fiddle/closure.c @@ -21,7 +21,7 @@ dealloc(void * ptr) #ifndef DONT_USE_FFI_CLOSURE_ALLOC ffi_closure_free(cls->pcl); #else - munmap(cls->pcl, sizeof(cls->pcl)); + munmap(cls->pcl, sizeof(*cls->pcl)); #endif if (cls->argv) xfree(cls->argv); xfree(cls); @@ -228,7 +228,10 @@ initialize(int rbargc, VALUE argv[], VALUE self) #else result = ffi_prep_closure(pcl, cif, callback, (void *)self); cl->code = (void *)pcl; - mprotect(pcl, sizeof(pcl), PROT_READ | PROT_EXEC); + i = mprotect(pcl, sizeof(*pcl), PROT_READ | PROT_EXEC); + if (i) { + rb_sys_fail("mprotect"); + } #endif if (FFI_OK != result) |