[Python-bugs-list] [ python-Bugs-416288 ] infrequent memory leak in pyexpat

noreply@sourceforge.net noreply@sourceforge.net
Thu, 28 Mar 2002 15:20:22 -0800


Bugs item #416288, was opened at 2001-04-15 19:35
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=416288&group_id=5470

Category: XML
Group: None
Status: Open
Resolution: None
Priority: 2
Submitted By: douglas orr (dougbo)
Assigned to: Martin v. Löwis (loewis)
Summary: infrequent memory leak in pyexpat

Initial Comment:
In pyexpat.c, the macro call for the handler dispatch 
(my##NAME##Handler) for CharacterHandler allocates an 
object implicitly by calling one of the conversion-to-
unicode routines.  

If there is a problem in the PyBuildValue, resulting 
in args == NULL, that object will be leaked.

Low priority, but the macros probably need some 
reworking to handle this.

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

>Comment By: Martin v. Löwis (loewis)
Date: 2002-03-29 00:20

Message:
Logged In: YES 
user_id=21627

No, currently, it can only leak: the argument being passed
will have an extra ref count, which supposedly will be
consumed by the tuple. If something fails, some of the N
arguments will have been stored in the
tuple-under-construction, and will be released when the
tuple is released. 'N' arguments not yet consumed will leak.

Processing should continue in case of an error, and DECREF
all N arguments.

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-03-28 23:34

Message:
Logged In: YES 
user_id=6380

Hm, the 'N' format code looks really scary. Can't it end up
DECREF'ing an object too many times if something fails?

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

Comment By: Martin v. Löwis (loewis)
Date: 2001-06-09 13:48

Message:
Logged In: YES 
user_id=21627

That seems to be a bug in Py_BuildValue: It should decref 
its N arguments if it can't create a tuple.



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

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=416288&group_id=5470