[Patches] [ python-Patches-669553 ] fix memory (ref) leaks

SourceForge.net noreply@sourceforge.net
Sat, 18 Jan 2003 16:04:36 -0800


Patches item #669553, was opened at 2003-01-16 23:02
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=669553&group_id=5470

Category: None
Group: None
Status: Open
>Resolution: Accepted
Priority: 5
Submitted By: Neal Norwitz (nnorwitz)
>Assigned to: Neal Norwitz (nnorwitz)
Summary: fix memory (ref) leaks

Initial Comment:
Sorry, I'm lazy and this is a single patch to 2 files
to fix reference leaks.  

The int patch can be demonstrated by doing:

  abs(-2147483648)

The second happens when:

  import pyexpat
  p = pyexpat.ParserCreate()
  p.__members__


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

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-01-18 19:04

Message:
Logged In: YES 
user_id=80475

There is an error in the patch to intobject.c.  When 
o==NULL, then result is returned without having been set.  
A revised patch is attached.  Otherwise, it's okay:  I verified 
the leak fix and ran regression tests without exception.

The second patch checks out okay.  It might be cleaner 
and faster to alter the PyList_New for the correct number 
of entries and then just use PyList_SET_ITEM.  That saves 
the double INCDEF followed by a DECREF and it shortens 
the code a bit.

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

Comment By: Michael Hudson (mwh)
Date: 2003-01-17 05:44

Message:
Logged In: YES 
user_id=6656

Looks fine to me.

I haven't tested it, but I assume it compiles and the tests
pass.  I can't see how you could write a test for this.

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

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