2009-02-27 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / metadata / monodiet.c
index 931ab9d9afeecf9576d16c3f840fa3cf633bc9d0..1ad1f538819b48207c633503e97fda3414b17d49 100644 (file)
@@ -128,7 +128,7 @@ add_types_from_method (MonoMethod *method) {
 
        locals = mono_method_header_get_locals (header, &n, NULL);
        for (i = 0; i < n; ++i) {
-               klass = mono_class_from_mono_type (locals);
+               klass = mono_class_from_mono_type (locals [i]);
                add_type (klass);
        }
        for (exc_iter = NULL; mono_method_header_get_clauses (header, method, &exc_iter, &clause);) {
@@ -218,6 +218,7 @@ handle_cattrs (MonoCustomAttrInfo* cattrs)
        for (i = 0; i < cattrs->num_attrs; ++i) {
                add_types_from_method (cattrs->attrs [i].ctor);
        }
+       mono_custom_attrs_free (cattrs);
 }
 
 static void
@@ -336,9 +337,8 @@ check_vmethods (MonoClass *klass, MonoMethod *method)
        if (!vtable)
                return;
        if (method->klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
-               if (method->klass->interface_id <= klass->max_interface_id &&
-                               (klass->interface_offsets [method->klass->interface_id] >= 0)) {
-                       int iface_offset = klass->interface_offsets [method->klass->interface_id];
+               if (MONO_CLASS_IMPLEMENTS_INTERFACE (klass, method->klass->interface_id)) {
+                       int iface_offset = mono_class_interface_offset (klass, method->klass);
                        g_assert (method->slot != -1);
                        if (vtable [iface_offset + method->slot])
                                add_types_from_method (vtable [iface_offset + method->slot]);