summaryrefslogtreecommitdiffstats
path: root/Python/codecs.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2005-11-24 22:09:18 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2005-11-24 22:09:18 (GMT)
commit3715c3e576a182692cf2ad2d390732126f11780d (patch)
tree3697c936d8d681dc025408bcc9db20824a3f2db6 /Python/codecs.c
parent430f68b447f61aab20b7db58705f6b16b10d5149 (diff)
downloadcpython-3715c3e576a182692cf2ad2d390732126f11780d.zip
cpython-3715c3e576a182692cf2ad2d390732126f11780d.tar.gz
cpython-3715c3e576a182692cf2ad2d390732126f11780d.tar.bz2
Fix a few more ref leaks. Backport candidate
Diffstat (limited to 'Python/codecs.c')
-rw-r--r--Python/codecs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/codecs.c b/Python/codecs.c
index 4b8d983..5c521fb 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -36,8 +36,7 @@ int PyCodec_Register(PyObject *search_function)
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 @@ PyObject *PyCodec_Encode(PyObject *object,
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 @@ PyObject *PyCodec_Encode(PyObject *object,
return v;
onError:
+ Py_XDECREF(result);
Py_XDECREF(args);
Py_XDECREF(encoder);
return NULL;