summaryrefslogtreecommitdiff
path: root/Python/codecs.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-09-23 19:59:34 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2014-09-23 19:59:34 +0300
commitcbcbfdf19f7e2824c95d534bab67839b693805dc (patch)
tree3b48238273a1627955b9e45cb6c56dc36cf49c96 /Python/codecs.c
parent21df71ae8e9f7ed1a0f3de6923fa30961ac15888 (diff)
parent8aa8c47db2f0205dec61d50274817cf6b0b15e0a (diff)
downloadcpython-git-cbcbfdf19f7e2824c95d534bab67839b693805dc.tar.gz
Fixed reference leak in the "backslashreplace" error handler.
Diffstat (limited to 'Python/codecs.c')
-rw-r--r--Python/codecs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/codecs.c b/Python/codecs.c
index faf1e92de6..02fce29561 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -890,8 +890,10 @@ PyObject *PyCodec_BackslashReplaceErrors(PyObject *exc)
ressize += 1+1+2;
}
res = PyUnicode_New(ressize, 127);
- if (res==NULL)
+ if (res == NULL) {
+ Py_DECREF(object);
return NULL;
+ }
for (i = start, outp = PyUnicode_1BYTE_DATA(res);
i < end; ++i) {
c = PyUnicode_READ_CHAR(object, i);