summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-03-27 21:47:54 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2006-03-27 21:47:54 (GMT)
commitadbd28f7b80c31918fb241ca2e3bfb92563f8945 (patch)
treec7dfbf2f6576f68eba11f6959abf9e13f15bffc9
parent97334aebefc6d2d0bbeeb38051c1366d70d5abef (diff)
downloadcpython-adbd28f7b80c31918fb241ca2e3bfb92563f8945.zip
cpython-adbd28f7b80c31918fb241ca2e3bfb92563f8945.tar.gz
cpython-adbd28f7b80c31918fb241ca2e3bfb92563f8945.tar.bz2
Backport of compile.c part of r41531 (neal.norwitz, 2005-11-24):
Fix a ref leak.
-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;