Title: fast builtin sum may leak
Type: behavior Stage:
Components: Interpreter Core Versions: Python 2.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: MrJean1, rhettinger
Priority: high Keywords: patch

Created on 2008-05-07 19:45 by MrJean1, last changed 2008-05-30 06:37 by rhettinger. This issue is now closed.

File name Uploaded Description Edit
bltinmodule1.c.diff MrJean1, 2008-05-07 19:45
Messages (3)
msg66368 - (view) Author: Jean Brouwers (MrJean1) Date: 2008-05-07 19:45
The new, fast builtin sum implementation may cause a memory leak in the 
float loop.  Both lines

    PyFPE_START_PROTECT("add", return 0)

should be changed to

    PyFPE_START_PROTECT("add", Py_DECREF(item); Py_DECREF(iter); return 

The attached file bltinmodule1.c.diff contain a patch to that extent.

/Jean Brouwers
msg66374 - (view) Author: Jean Brouwers (MrJean1) Date: 2008-05-07 20:29
There is one other, similar issue in the Modules/imgfile.c file.  Line 327 

	PyFPE_START_PROTECT("readscaled", return 0)

and should probably be

	PyFPE_START_PROTECT("readscaled", iclose(image); return 0)

/Jean Brouwers
msg67521 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-05-30 06:37
Fixed in r63805.
Date User Action Args
2008-05-30 06:37:49rhettingersetstatus: open -> closed
resolution: fixed
messages: + msg67521
2008-05-09 05:54:12rhettingersetpriority: high
2008-05-08 02:14:28rhettingersetassignee: rhettinger
nosy: + rhettinger
2008-05-07 20:29:07MrJean1setmessages: + msg66374
2008-05-07 19:45:38MrJean1create