From 8aa8c47db2f0205dec61d50274817cf6b0b15e0a Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 23 Sep 2014 19:59:09 +0300 Subject: [PATCH] Fixed reference leak in the "backslashreplace" error handler. --- Python/codecs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Python/codecs.c b/Python/codecs.c index 6b8033ecf8c..e584accf720 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);