From: Martin v. Löwis Date: Wed, 1 Mar 2006 21:33:54 +0000 (+0000) Subject: Fix more memory leaks. Will backport to 2.4. X-Git-Tag: v2.5a0~429 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0b300be8957557b64e7d4a630ca5197b9224ac76;p=thirdparty%2FPython%2Fcpython.git Fix more memory leaks. Will backport to 2.4. --- diff --git a/Python/modsupport.c b/Python/modsupport.c index 2356a9e57eeb..f53e4c362ee8 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -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);