From 518f2a5184b8f6f14cf5e066b4d5079244eaef9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Wed, 1 Mar 2006 21:36:32 +0000 Subject: Backport of memory leak fixes. --- Python/modsupport.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Python/modsupport.c b/Python/modsupport.c index ad5b675..152fdf7 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); -- cgit v0.12