Commit 8aa8c47d authored by Serhiy Storchaka's avatar Serhiy Storchaka

Fixed reference leak in the "backslashreplace" error handler.

parent eb83ffe1
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment