classification
Title: Memory leak in PyUnicode_TranslateCharmap()
Type: resource usage Stage: resolved
Components: Interpreter Core Versions: Python 3.4, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: christian.heimes, georg.brandl, jcea, python-dev
Priority: normal Keywords: 3.3regression, patch

Created on 2012-09-10 09:58 by christian.heimes, last changed 2012-09-24 05:46 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
translate_leak.patch christian.heimes, 2012-09-10 09:58 review
Messages (6)
msg170170 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2012-09-10 09:58
Objects/unicodeobject.c:PyUnicode_TranslateCharmap() leaks a reference to the variable unicode. PyUnicode_Translate() is also implemented around the helper function _PyUnicode_TranslateCharmap() but it properly decrefs the reference to the first argument.

PyUnicode_Translate() also has an obsolete onError goto label. The patch fixes the leak and simplifies PyUnicode_Translate().

CID 719686
msg170211 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2012-09-10 18:10
Looks good to me. Are 2.7/3.2 not affected?.

Christian, Please, commit the patch and notify Georg for 3.3.0 inclusion.
msg170293 - (view) Author: Roundup Robot (python-dev) Date: 2012-09-11 12:03
New changeset 4f2811e5e462 by Christian Heimes in branch 'default':
Issue #15900: Fixed reference leak in PyUnicode_TranslateCharmap()
http://hg.python.org/cpython/rev/4f2811e5e462
msg170294 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2012-09-11 12:05
Yes, 3.2 and earlier are not affected.

Georg, I'm assigning the bug to you so you can decide if you like to cherry pick the fix.
msg170964 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-09-22 07:24
Done as 89f62f143920.
msg171095 - (view) Author: Roundup Robot (python-dev) Date: 2012-09-24 05:46
New changeset 89f62f143920 by Christian Heimes in branch 'default':
Issue #15900: Fixed reference leak in PyUnicode_TranslateCharmap()
http://hg.python.org/cpython/rev/89f62f143920
History
Date User Action Args
2012-09-24 05:46:45python-devsetmessages: + msg171095
2012-09-22 07:24:45georg.brandlsetstatus: open -> closed

messages: + msg170964
2012-09-11 12:05:26christian.heimessetnosy: + georg.brandl
messages: + msg170294

assignee: georg.brandl
resolution: fixed
stage: resolved
2012-09-11 12:03:34python-devsetnosy: + python-dev
messages: + msg170293
2012-09-10 18:10:04jceasetnosy: + jcea
messages: + msg170211
2012-09-10 09:58:22christian.heimescreate