summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortduehr <td@matasano.com>2015-06-30 21:39:39 -0500
committertduehr <td@matasano.com>2015-06-30 21:39:39 -0500
commit39ac2163d8ec3cb107aa9b4a2085dfbdef682a26 (patch)
tree53b70edb571e7937ca555e61233df58b50e2a590
parentc802c98205c8f98dbd05a6c9604c911014d71730 (diff)
parent7314d2c5e6945a941111292cf40a6cd6813b38c9 (diff)
downloadffi-39ac2163d8ec3cb107aa9b4a2085dfbdef682a26.tar.gz
Merge pull request #441 from jaym/issue440
methodHandleParamTypes needs to refer to valid memory after rbffi_MethodHandle_Init
-rw-r--r--ext/ffi_c/MethodHandle.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ext/ffi_c/MethodHandle.c b/ext/ffi_c/MethodHandle.c
index b60f9cc..cee1df5 100644
--- a/ext/ffi_c/MethodHandle.c
+++ b/ext/ffi_c/MethodHandle.c
@@ -132,6 +132,12 @@ rbffi_MethodHandle_CodeAddress(MethodHandle* handle)
#ifndef CUSTOM_TRAMPOLINE
static void attached_method_invoke(ffi_cif* cif, void* retval, METHOD_PARAMS parameters, void* user_data);
+static ffi_type* methodHandleParamTypes[] = {
+ &ffi_type_sint,
+ &ffi_type_pointer,
+ &ffi_type_ulong,
+};
+
static ffi_cif mh_cif;
static bool
@@ -333,12 +339,7 @@ void
rbffi_MethodHandle_Init(VALUE module)
{
#ifndef CUSTOM_TRAMPOLINE
- ffi_status ffiStatus;
- ffi_type* methodHandleParamTypes[] = {
- &ffi_type_sint,
- &ffi_type_pointer,
- &ffi_type_ulong,
- };
+ ffi_status ffiStatus;
#endif
defaultClosurePool = rbffi_ClosurePool_New((int) trampoline_size(), prep_trampoline, NULL);