diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-23 16:58:57 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-23 16:58:57 (GMT) |
commit | 7d96a09aca160f721820c2a63fcd3bfe100c050e (patch) | |
tree | 0f070cfc0263120119dff3f1f0a3e69f52c71e59 | |
parent | 70d92556ebeeb71728e30be862a8c72b3d753024 (diff) | |
download | cpython-7d96a09aca160f721820c2a63fcd3bfe100c050e.zip cpython-7d96a09aca160f721820c2a63fcd3bfe100c050e.tar.gz cpython-7d96a09aca160f721820c2a63fcd3bfe100c050e.tar.bz2 |
Fixed reference leak in the "backslashreplace" error handler.
-rw-r--r-- | Python/codecs.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/codecs.c b/Python/codecs.c index 69498c4..7d1145f 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -696,8 +696,10 @@ PyObject *PyCodec_BackslashReplaceErrors(PyObject *exc) ressize += 1+1+2; } res = PyUnicode_FromUnicode(NULL, ressize); - if (res==NULL) + if (res == NULL) { + Py_DECREF(object); return NULL; + } for (p = startp+start, outp = PyUnicode_AS_UNICODE(res); p < startp+end; ++p) { Py_UNICODE c = *p; |