[Python-bugs-list] [ python-Bugs-592645 ] memory leak in socket.getaddrinfo

noreply@sourceforge.net noreply@sourceforge.net
Thu, 08 Aug 2002 15:56:28 -0700


Bugs item #592645, was opened at 2002-08-08 17:34
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=592645&group_id=5470

Category: Extension Modules
Group: Python 2.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Jean-Claude Rimbault (jcrimbault)
>Assigned to: Martin v. Löwis (loewis)
Summary: memory leak in socket.getaddrinfo

Initial Comment:
Function getaddrinfo of the socket module
fails to free system allocated result when the call is
successful
(but it does on error). Il should call freeaddrinfo to
free res0
before returning Python result.

This leak is also affecting httplib and urllib because
since Python 2.2, httplib.HTTPConnection.connect method
does call socket.getaddrinfo.

Small test program showing off the leak:

import socket, time

while 1:
    res = socket.getaddrinfo('localhost', 80, 0,
socket.SOCK_STREAM)
    time.sleep(0.01)


Tested with Python 2.2.1 under Linux 2.4

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

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