summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-09-23 16:59:09 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-09-23 16:59:09 (GMT)
commit8aa8c47db2f0205dec61d50274817cf6b0b15e0a (patch)
tree25532538f0889f9ad6480999f6f6053eea3b301c /Python
parenteb83ffe1b3ffda0179b83244a4c25afe367c1b4d (diff)
downloadcpython-8aa8c47db2f0205dec61d50274817cf6b0b15e0a.zip
cpython-8aa8c47db2f0205dec61d50274817cf6b0b15e0a.tar.gz
cpython-8aa8c47db2f0205dec61d50274817cf6b0b15e0a.tar.bz2
Fixed reference leak in the "backslashreplace" error handler.
Diffstat (limited to 'Python')
-rw-r--r--Python/codecs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/codecs.c b/Python/codecs.c
index 6b8033e..e584acc 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);