Mercurial > cpython-lru_cache-weakref
diff Modules/_ssl.c @ 29695:d0dc956467bf legacy-trunk
Fix SF #754870, SSL crash interpreter when remote side closes during connect
Also fix a memory leak.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Mon, 30 Jun 2003 03:25:20 +0000 |
| parents | a4d6bc71f091 |
| children | 6f15e73b59f2 |
line wrap: on
line diff
--- a/Modules/_ssl.c Mon Jun 30 02:14:28 2003 +0000 +++ b/Modules/_ssl.c Mon Jun 30 03:25:20 2003 +0000 @@ -110,7 +110,7 @@ { unsigned long e = ERR_get_error(); if (e == 0) { - if (ret == 0) { + if (ret == 0 || !obj->Socket) { p = PY_SSL_ERROR_EOF; errstr = "EOF occurred in violation of protocol"; } else if (ret == -1) { @@ -432,6 +432,7 @@ timedout = wait_for_timeout(self->Socket, 0); if (timedout) { PyErr_SetString(PySSLErrorObject, "The read operation timed out"); + Py_DECREF(buf); return NULL; } do {
