Sure looks like it to me! <wink>
When I run the leak2.py script I posted to python-dev, I only see
three reference leaks in all of test_descr. When I run
test_descr.test_main, I still see 46 leaks. This clearly demands
posting a yelp to python-dev :-)
This certainly should be applied to release23-maint, and in all
likelyhood release22-maint as well.
/* Calculate best base, and check that all bases are type objects */
base = best_base(bases);
- if (base == NULL)
+ if (base == NULL) {
+ Py_DECREF(bases);
return NULL;
+ }
if (!PyType_HasFeature(base, Py_TPFLAGS_BASETYPE)) {
PyErr_Format(PyExc_TypeError,
"type '%.100s' is not an acceptable base type",
base->tp_name);
+ Py_DECREF(bases);
return NULL;
}
slots = Py_BuildValue("(O)", slots);
else
slots = PySequence_Tuple(slots);
- if (slots == NULL)
+ if (slots == NULL) {
+ Py_DECREF(bases);
return NULL;
+ }
assert(PyTuple_Check(slots));
/* Are slots allowed? */
"not supported for subtype of '%s'",
base->tp_name);
bad_slots:
+ Py_DECREF(bases);
Py_DECREF(slots);
return NULL;
}
type = (PyTypeObject *)metatype->tp_alloc(metatype, nslots);
if (type == NULL) {
Py_XDECREF(slots);
+ Py_DECREF(bases);
return NULL;
}