Commits

Ronald Oussoren committed b56c365

- Fix reference counting
- use PyTuple_GET_ITEM instead of PyTuple_GetItem

Comments (0)

Files changed (1)

Modules/objc/objc-class.m

 /*
  * Due to the way dynamicly created PyTypeObject's are processed it is not 
  * possible to add new fields to a type struct in Python 2.2. We therefore
- * store the additional information in a seperate data-structure. 
+ * store the additional information in a separate data-structure. 
  *
  * The struct class_info contains the additional information for a class object,
  * and class_to_objc stores a mapping from a class object to its additional
 {
 	if (class_registry == NULL) return 0;
 
+	/* XXX: Aren't we leaking memory here, I'd expect that we'd have
+         *      to DECREF the py_class.
+	 */ 
 	NSMapRemove(class_registry, objc_class);
 	return 0;
 }
 }
 
 
-
-
-
-
 /*
  * Create a new objective-C class, as a subclass of 'type'. This is
  * PyObjCClass_Type.tp_new.
 		return NULL;
 	}
 
-	v = PyTuple_GetItem(bases, 0);
+	v = PyTuple_GET_ITEM(bases, 0);
 	if (v == NULL) {
 		return NULL;
 	}
 	}
 
 	for (i = 1; i < len; i++) {
-		v = PyTuple_GetItem(bases, i);
+		v = PyTuple_GET_ITEM(bases, i);
 		if (v == NULL) {
 			return NULL;
 		}
 		if (!recursive) break;
 		if (info->class->super_class == NULL) break;
 		cls = PyObjCClass_New(info->class->super_class);
-			/* XXX REFCNT leak!! */
+
+		Py_DECREF(cls);
 		info = get_class_info(cls);
-
 	}
 }
 
 		}
 	}
 
-	Py_DECREF(keys);
 	Py_DECREF(args);
 
 	return 0;