[ python-Bugs-416288 ] infrequent memory leak in pyexpat

SourceForge.net noreply at sourceforge.net
Wed Apr 12 10:01:05 CEST 2006


Bugs item #416288, was opened at 2001-04-15 19:35
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=416288&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: XML
Group: None
Status: Open
Resolution: None
Priority: 2
Submitted By: douglas orr (dougbo)
>Assigned to: Nobody/Anonymous (nobody)
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: 2006-04-12 10:01

Message:
Logged In: YES 
user_id=21627

I don't think I will do anything about this anytime soon, so
unassigning myself.

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

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: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=416288&group_id=5470


More information about the Python-bugs-list mailing list