[Python-checkins] cpython: Fix refleaks introduced by 83da67651687.
antoine.pitrou
python-checkins at python.org
Sat May 12 16:00:31 CEST 2012
http://hg.python.org/cpython/rev/9d9495fabeb9
changeset: 76882:9d9495fabeb9
user: Antoine Pitrou <solipsis at pitrou.net>
date: Sat May 12 15:51:51 2012 +0200
summary:
Fix refleaks introduced by 83da67651687.
files:
Objects/unicodeobject.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -9079,8 +9079,11 @@
buf1 = PyUnicode_DATA(str_obj);
buf2 = PyUnicode_DATA(sub_obj);
if (kind2 != kind) {
- if (kind2 > kind)
+ if (kind2 > kind) {
+ Py_DECREF(sub_obj);
+ Py_DECREF(str_obj);
return 0;
+ }
buf2 = _PyUnicode_AsKind(sub_obj, kind);
}
if (!buf2)
@@ -10659,8 +10662,11 @@
buf1 = PyUnicode_DATA(str);
buf2 = PyUnicode_DATA(sub);
if (kind2 != kind) {
- if (kind2 > kind)
+ if (kind2 > kind) {
+ Py_DECREF(sub);
+ Py_DECREF(str);
return 0;
+ }
buf2 = _PyUnicode_AsKind(sub, kind);
}
if (!buf2) {
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list