diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-03-01 21:36:32 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-03-01 21:36:32 (GMT) |
commit | 518f2a5184b8f6f14cf5e066b4d5079244eaef9d (patch) | |
tree | 3fbc2e650deb8eca69d0ed958dda947eb358b6a2 | |
parent | 68e4cbbcb6e129d468bf4a9e121684ce578735d5 (diff) | |
download | cpython-518f2a5184b8f6f14cf5e066b4d5079244eaef9d.zip cpython-518f2a5184b8f6f14cf5e066b4d5079244eaef9d.tar.gz cpython-518f2a5184b8f6f14cf5e066b4d5079244eaef9d.tar.bz2 |
Backport of memory leak fixes.
-rw-r--r-- | Python/modsupport.c | 6 |
1 files changed, 5 insertions, 1 deletions
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); |