This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Memleak in import.c load_source_module()
Type: resource usage Stage: resolved
Components: Interpreter Core Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, brett.cannon, cassou, lemburg, ncoghlan, pitrou, python-dev, tim.peters
Priority: normal Keywords: patch

Created on 2012-05-09 08:45 by cassou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fix_load_source_module_leak.patch cassou, 2012-05-09 08:45 Patch that fixes a memory leak in load_source_module() from import.c
Messages (6)
msg160262 - (view) Author: Damien Cassou (cassou) Date: 2012-05-09 08:45
In load_source_module() function from import.c, it looks like Py_DECREF is not called where it should be. Please find attached a patch that fixes the leak. 

This bug has been found using Coccinelle (http://coccinelle.lip6.fr/) using a semantic patch (similar to https://gist.github.com/2634899).
msg160264 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-05-09 08:47
Is it 2.7-only?
msg160265 - (view) Author: Damien Cassou (cassou) Date: 2012-05-09 08:51
@pitrou I just checked Python-2.7.3 and the tip of the mercurial repository. It's not in the latter at least.
msg160271 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-05-09 11:27
New changeset a775fc27f469 by Antoine Pitrou in branch '2.7':
Issue #14761: Fix potential leak on an error case in the import machinery.
http://hg.python.org/cpython/rev/a775fc27f469
msg160272 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-05-09 11:30
New changeset 9de4d85e4197 by Antoine Pitrou in branch '3.2':
Issue #14761: Fix potential leak on an error case in the import machinery.
http://hg.python.org/cpython/rev/9de4d85e4197

New changeset 840cb46d0395 by Antoine Pitrou in branch 'default':
Null merge for issue #14761.
http://hg.python.org/cpython/rev/840cb46d0395
msg160274 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-05-09 11:31
Fixed, thank you!
History
Date User Action Args
2022-04-11 14:57:30adminsetgithub: 58966
2012-05-09 11:31:36pitrousetstatus: open -> closed
versions: + Python 3.2
messages: + msg160274

resolution: fixed
stage: patch review -> resolved
2012-05-09 11:30:24python-devsetmessages: + msg160272
2012-05-09 11:27:19python-devsetnosy: + python-dev
messages: + msg160271
2012-05-09 08:51:59cassousetmessages: + msg160265
2012-05-09 08:47:59pitrousetnosy: + pitrou, brett.cannon, ncoghlan
messages: + msg160264

type: resource usage
stage: patch review
2012-05-09 08:45:54cassoucreate