mirror of
https://github.com/python/cpython.git
synced 2025-08-27 04:05:34 +00:00
Fix more memory leaks. Will backport to 2.4.
This commit is contained in:
parent
c3547a311e
commit
0b300be895
1 changed files with 5 additions and 1 deletions
|
@ -71,13 +71,17 @@ Py_InitModule4(const char *name, PyMethodDef *methods, const char *doc,
|
|||
PyErr_SetString(PyExc_ValueError,
|
||||
"module functions cannot set"
|
||||
" METH_CLASS or METH_STATIC");
|
||||
Py_DECREF(n);
|
||||
return NULL;
|
||||
}
|
||||
v = PyCFunction_NewEx(ml, passthrough, n);
|
||||
if (v == NULL)
|
||||
if (v == NULL) {
|
||||
Py_DECREF(n);
|
||||
return NULL;
|
||||
}
|
||||
if (PyDict_SetItemString(d, ml->ml_name, v) != 0) {
|
||||
Py_DECREF(v);
|
||||
Py_DECREF(n);
|
||||
return NULL;
|
||||
}
|
||||
Py_DECREF(v);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue