[Patches] [ python-Patches-751114 ] fix memory leaks in posixmodule on Windows

SourceForge.net noreply@sourceforge.net
Mon, 16 Jun 2003 19:10:15 -0700


Patches item #751114, was opened at 2003-06-08 21:39
Message generated for change (Comment added) made by tim_one
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=751114&group_id=5470

Category: Modules
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Neal Norwitz (nnorwitz)
>Assigned to: Mark Hammond (mhammond)
Summary: fix memory leaks in posixmodule on Windows

Initial Comment:
The attached patch should fix memory leaks from
os.listdir() on Windows.  I can't test this, but it
appears that bufptr was leaked in most circumstances.

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2003-06-16 22:10

Message:
Logged In: YES 
user_id=31435

Reassigned to MarkH, since CVS annotate shows his name in 
this area more than anyone else's.

Offhand I don't see a reason to believe there's a leak here:  
looks like bufptr is non-NULL when PyArg_ParseTuple() is 
called, pointing to stack memory, and

"""
If *buffer points to a non-NULL pointer (an already allocated 
buffer), PyArg_ParseTuple() will use this location as buffer 
and interpret *buffer_length as buffer size. It will then copy 
the encoded data into the buffer and 0-terminate it. Buffer 
overflow is signalled with an exception. 
"""

If so, we certainly shouldn't try to free it!

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=751114&group_id=5470