2009-02-23 Mark Probst <mark.probst@gmail.com>
[mono.git] / mono / mini / declsec.c
index e9925816145b5aa06be65aba28293d46a409686b..65e38d7f8fe5b29cb3e0b517954faace3cd71875 100644 (file)
@@ -19,7 +19,7 @@ mono_method_has_declsec (MonoMethod *method)
 {
        mono_jit_stats.cas_declsec_check++;
 
-       if (method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE) {
+       if (method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE || method->wrapper_type == MONO_WRAPPER_MANAGED_TO_MANAGED) {
                method = mono_marshal_method_from_wrapper (method);
                if (!method)
                        return FALSE;
@@ -214,6 +214,8 @@ mono_declsec_linkdemand_aptc (MonoDomain *domain, MonoMethod *caller, MonoMethod
                        /* look for AllowPartiallyTrustedCallersAttribute */
                        result = mono_custom_attrs_has_attr (cinfo, secman->allowpartiallytrustedcallers);
                }
+               if (cinfo)
+                       mono_custom_attrs_free (cinfo);
                MONO_SECMAN_FLAG_SET_VALUE (assembly->aptc, result);
        }