diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-03-01 21:33:54 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-03-01 21:33:54 (GMT) |
commit | 0b300be8957557b64e7d4a630ca5197b9224ac76 (patch) | |
tree | 243672bbaef6bdb42446ef8c8308a6172a73358c /Python | |
parent | c3547a311eda0e8c398841b40b5beed332de499e (diff) | |
download | cpython-0b300be8957557b64e7d4a630ca5197b9224ac76.zip cpython-0b300be8957557b64e7d4a630ca5197b9224ac76.tar.gz cpython-0b300be8957557b64e7d4a630ca5197b9224ac76.tar.bz2 |
Fix more memory leaks. Will backport to 2.4.
Diffstat (limited to 'Python')
-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 2356a9e..f53e4c3 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); |