Skip to content

Commit 5c32ea2

Browse files
author
martin.v.loewis
committed
Fix more memory leaks. Will backport to 2.4.
git-svn-id: http://svn.python.org/projects/python/trunk@42740 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 32576a2 commit 5c32ea2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Python/modsupport.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,17 @@ Py_InitModule4(const char *name, PyMethodDef *methods, const char *doc,
7171
PyErr_SetString(PyExc_ValueError,
7272
"module functions cannot set"
7373
" METH_CLASS or METH_STATIC");
74+
Py_DECREF(n);
7475
return NULL;
7576
}
7677
v = PyCFunction_NewEx(ml, passthrough, n);
77-
if (v == NULL)
78+
if (v == NULL) {
79+
Py_DECREF(n);
7880
return NULL;
81+
}
7982
if (PyDict_SetItemString(d, ml->ml_name, v) != 0) {
8083
Py_DECREF(v);
84+
Py_DECREF(n);
8185
return NULL;
8286
}
8387
Py_DECREF(v);

0 commit comments

Comments
 (0)