diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-05-12 13:51:51 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-05-12 13:51:51 (GMT) |
commit | 758153badb991ba3f77c7df913137e274b6eaaf4 (patch) | |
tree | 399794dffca44588e3fb29cb10ef2032077aed0d /Objects | |
parent | e45c0c5cefaa634ce1bf9efe95523756c60917c7 (diff) | |
download | cpython-758153badb991ba3f77c7df913137e274b6eaaf4.zip cpython-758153badb991ba3f77c7df913137e274b6eaaf4.tar.gz cpython-758153badb991ba3f77c7df913137e274b6eaaf4.tar.bz2 |
Fix refleaks introduced by 83da67651687.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 97de48f..4a1cce2 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9079,8 +9079,11 @@ PyUnicode_Count(PyObject *str, 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 @@ PyUnicode_Contains(PyObject *container, PyObject *element) 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) { |