[Python-bugs-list] [ python-Bugs-472798 ] SSL in non-blocking mode (original) (raw)

noreply@sourceforge.net noreply@sourceforge.net
Fri, 19 Oct 2001 07:26:33 -0700


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

Category: Python Library Group: Python 2.1.1 Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: SSL in non-blocking mode

Initial Comment: There is a memory leak when you use SSL sockets in Non-blocking mode.

The fix that works for me: In socketmodule.c, in function SSL_SSLRead() Add a Py_DECREF(buf); to the default in the switch statement.

Below is the code to change...

Change the switch statement from:

switch (res) { case SSL_ERROR_NONE: assert(count > 0); break; case SSL_ERROR_ZERO_RETURN: /* normal EOF */ assert(count == 0); break; default: return PyErr_SetFromErrno(SSLErrorObject); }

To

switch (res) { case SSL_ERROR_NONE: assert(count > 0); break; case SSL_ERROR_ZERO_RETURN: /* normal EOF */ assert(count == 0); break; default: Py_DECREF(buf); return PyErr_SetFromErrno(SSLErrorObject); }

Note the Py_DECREF(buf); in the default case


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