summaryrefslogtreecommitdiff
path: root/Python/codecs.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-09-23 19:59:09 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2014-09-23 19:59:09 +0300
commit4dd73af37ac1d749a85d9384205be1929f708ce9 (patch)
tree489f153da9bb72b30e0196a1c7a2288085efccc2 /Python/codecs.c
parent8fbf791aa8c51ce491634ac1b2a6e86bd290e6e3 (diff)
downloadcpython-4dd73af37ac1d749a85d9384205be1929f708ce9.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 6b8033ecf8..e584accf72 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);