[Python-Dev] cpython: fix some possible refleaks from PyUnicode_READY error conditions (original) (raw)
Benjamin Peterson benjamin at python.org
Mon Jan 2 16:07:54 CET 2012
- Previous message: [Python-Dev] cpython: fix some possible refleaks from PyUnicode_READY error conditions
- Next message: [Python-Dev] RNG in the core
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
2012/1/2 Antoine Pitrou <solipsis at pitrou.net>:
On Mon, 02 Jan 2012 16:00:50 +0100 benjamin.peterson <python-checkins at python.org> wrote:
http://hg.python.org/cpython/rev/d5cda62d0f8c changeset: 74236:d5cda62d0f8c user: Benjamin Peterson <benjamin at python.org> date: Mon Jan 02 09:00:30 2012 -0600 summary: fix some possible refleaks from PyUnicodeREADY error conditions
files: Objects/unicodeobject.c | 80 ++++++++++++++++++++-------- 1 files changed, 56 insertions(+), 24 deletions(-)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9132,10 +9132,15 @@ Pyssizet len1, len2; strobj = PyUnicodeFromObject(str); - if (!strobj || PyUnicodeREADY(strobj) == -1) + if (!strobj) return -1; subobj = PyUnicodeFromObject(substr); - if (!subobj || PyUnicodeREADY(subobj) == -1) { + if (!subobj) { + PyDECREF(strobj); + return -1; + } + if (PyUnicodeREADY(substr) == -1 || PyUnicodeREADY(strobj) == -1) { Shouldn't the first one be PyUnicodeREADY(subobj) ?
Yes.
-- Regards, Benjamin
- Previous message: [Python-Dev] cpython: fix some possible refleaks from PyUnicode_READY error conditions
- Next message: [Python-Dev] RNG in the core
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]