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

noreply@sourceforge.net noreply@sourceforge.net
Thu, 08 Aug 2002 20:38:27 -0700


Bugs item #592645, was opened at 2002-08-08 11: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: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Jean-Claude Rimbault (jcrimbault)
>Assigned to: Neal Norwitz (nnorwitz)
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

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

>Comment By: Neal Norwitz (nnorwitz)
Date: 2002-08-08 23:38

Message:
Logged In: YES 
user_id=33168

You are correct.  Thanks!

Checked in as Modules/socketmodule.c 1.243 and 1.200.6.8.

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

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