8000 gh-116810: fix memory leak in ssl module by jeffvanvoorst · Pull Request #123249 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-116810: fix memory leak in ssl module #123249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Resolve a memory leak introduced in CPython 3.10's :mod:`ssl` when the
:attr:`ssl.SSLSocket.session` property was accessed.
12 changes: 3 additions & 9 deletions Modules/_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2844,15 +2844,9 @@ PySSL_get_session(PySSLSocket *self, void *closure) {
PySSLSession *pysess;
SSL_SESSION *session;

/* duplicate session as workaround for session bug in OpenSSL 1.1.0,
* https://github.com/openssl/openssl/issues/1550 */
session = SSL_get0_session(self->ssl); /* borrowed reference */
if (session == NULL) {
Py_RETURN_NONE;
}
if ((session = _ssl_session_dup(session)) == NULL) {
return NULL;
}
/* See discussion on https://github.com/python/cpython/pull/123249 and
* older discussion on https://github.com/openssl/openssl/issues/1550.
* CPython is NOT doing the right thing here. */
session = SSL_get1_session(self->ssl);
if (session == NULL) {
Py_RETURN_NONE;
Expand Down
Loading
0