diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-03-01 21:33:54 +0000 |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-03-01 21:33:54 +0000 |
commit | a9c518868df1552ffc3642ee61ba82e9de85993f (patch) | |
tree | 1f14ba72944f50550a3b398f3e968fe4e134760f /Python/modsupport.c | |
parent | fa2ad839ee858dc957ab21d88a451d5bd1aa4c35 (diff) | |
download | cpython-a9c518868df1552ffc3642ee61ba82e9de85993f.tar.gz |
Fix more memory leaks. Will backport to 2.4.
Diffstat (limited to 'Python/modsupport.c')
-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 2356a9e57e..f53e4c362e 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); |