[Python-checkins] cpython (3.4): Fixed reference leak in the "backslashreplace" error handler.

serhiy.storchaka python-checkins at python.org
Tue Sep 23 19:03:06 CEST 2014


https://hg.python.org/cpython/rev/80e0fc462005
changeset: 92534:80e0fc462005
branch: 3.4
parent: 92531:8eb4eec8626c
user: Serhiy Storchaka <storchaka at gmail.com>
date: Tue Sep 23 19:59:09 2014 +0300
summary:
 Fixed reference leak in the "backslashreplace" error handler.
files:
 Python/codecs.c | 4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/Python/codecs.c b/Python/codecs.c
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -890,8 +890,10 @@
 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);
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /