the object being inserted was not being DECREFed.
This closes SF bug #444486.
v = PyCFunction_New(ml, passthrough);
if (v == NULL)
return NULL;
- if (PyDict_SetItemString(d, ml->ml_name, v) != 0)
+ if (PyDict_SetItemString(d, ml->ml_name, v) != 0) {
+ Py_DECREF(v);
return NULL;
+ }
Py_DECREF(v);
}
if (doc != NULL) {
v = PyString_FromString(doc);
- if (v == NULL || PyDict_SetItemString(d, "__doc__", v) != 0)
+ if (v == NULL || PyDict_SetItemString(d, "__doc__", v) != 0) {
+ Py_DECREF(v);
return NULL;
+ }
Py_DECREF(v);
}
return m;