diff --git a/ChangeLog b/ChangeLog index ee0d7aaa2c..87cbad0091 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Oct 30 09:08:27 2010 Nobuyoshi Nakada + + * ext/fiddle/closure.c (fiddle_closure): embed cif not reference + so that the content surely get initialized. [ruby-dev:42480] + Sat Oct 30 07:01:53 2010 Tanaka Akira * lib/resolv-replace.rb: suppress warning. diff --git a/ext/fiddle/closure.c b/ext/fiddle/closure.c index 5e9ede7b2d..157b97ca46 100644 --- a/ext/fiddle/closure.c +++ b/ext/fiddle/closure.c @@ -5,7 +5,7 @@ VALUE cFiddleClosure; typedef struct { void * code; ffi_closure *pcl; - ffi_cif * cif; + ffi_cif cif; int argc; ffi_type **argv; } fiddle_closure; @@ -23,7 +23,6 @@ dealloc(void * ptr) #else munmap(cls->pcl, sizeof(cls->pcl)); #endif - xfree(cls->cif); if (cls->argv) xfree(cls->argv); xfree(cls); } @@ -37,7 +36,7 @@ closure_memsize(const void * ptr) if (ptr) { size += sizeof(*cls); #if !defined(FFI_NO_RAW_API) || !FFI_NO_RAW_API - size += ffi_raw_size(cls->cif); + size += ffi_raw_size(&cls->cif); #endif size += sizeof(*cls->argv); size += sizeof(ffi_closure); @@ -148,7 +147,6 @@ allocate(VALUE klass) closure->pcl = mmap(NULL, sizeof(ffi_closure), PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); #endif - closure->cif = xmalloc(sizeof(ffi_cif)); return i; } @@ -185,7 +183,7 @@ initialize(int rbargc, VALUE argv[], VALUE self) rb_iv_set(self, "@ctype", ret); rb_iv_set(self, "@args", args); - cif = cl->cif; + cif = &cl->cif; pcl = cl->pcl; result = ffi_prep_cif(cif, NUM2INT(abi), argc,