[Patches] [ python-Patches-751114 ] fix memory leaks in posixmodule on Windows
SourceForge.net
noreply@sourceforge.net
Thu, 24 Jul 2003 03:24:14 -0700
Patches item #751114, was opened at 2003-06-09 11:39
Message generated for change (Comment added) made by mhammond
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: Closed
>Resolution: Invalid
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: Mark Hammond (mhammond)
Date: 2003-07-24 20:24
Message:
Logged In: YES
user_id=14198
As Tim says, that is not a leak. These semantics exist
exactly so this module did not have to take the penalty of
managing the memory in every single existing function that
wants to use "et"
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2003-06-17 12: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