Mercurial > cpython-lru_cache-weakref
diff Python/codecs.c @ 35939:79374eb6db51 legacy-trunk
Fix a few more ref leaks. Backport candidate
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Thu, 24 Nov 2005 22:09:18 +0000 |
| parents | 201986d6d9d6 |
| children | 7fdc639bc5b4 |
line wrap: on
line diff
--- a/Python/codecs.c Thu Nov 24 22:00:56 2005 +0000 +++ b/Python/codecs.c Thu Nov 24 22:09:18 2005 +0000 @@ -36,8 +36,7 @@ goto onError; } if (!PyCallable_Check(search_function)) { - PyErr_SetString(PyExc_TypeError, - "argument must be callable"); + PyErr_SetString(PyExc_TypeError, "argument must be callable"); goto onError; } return PyList_Append(interp->codec_search_path, search_function); @@ -305,7 +304,7 @@ const char *errors) { PyObject *encoder = NULL; - PyObject *args = NULL, *result; + PyObject *args = NULL, *result = NULL; PyObject *v; encoder = PyCodec_Encoder(encoding); @@ -336,6 +335,7 @@ return v; onError: + Py_XDECREF(result); Py_XDECREF(args); Py_XDECREF(encoder); return NULL;
