From: Martin v. Löwis Date: Wed, 1 Mar 2006 21:36:32 +0000 (+0000) Subject: Backport of memory leak fixes. X-Git-Tag: v2.4.3c1~53 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=518f2a5184b8f6f14cf5e066b4d5079244eaef9d;p=thirdparty%2FPython%2Fcpython.git Backport of memory leak fixes. --- diff --git a/Python/modsupport.c b/Python/modsupport.c index ad5b67522e44..152fdf7ea039 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -71,13 +71,17 @@ Py_InitModule4(char *name, PyMethodDef *methods, 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);