gh-142438: Added missing GIL release in _PySSL_keylog_callback when keylog_bio is unset (gh-142439)

This commit is contained in:
AZero13 2025-12-11 09:30:39 -05:00 committed by GitHub
parent 79aa43a979
commit 44d3dc6491
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1 @@
Fixed a possible leaked GIL in _PySSL_keylog_callback.

View file

@ -131,7 +131,7 @@ _PySSL_keylog_callback(const SSL *ssl, const char *line)
PyThread_type_lock lock = get_state_sock(ssl_obj)->keylog_lock;
assert(lock != NULL);
if (ssl_obj->ctx->keylog_bio == NULL) {
return;
goto done;
}
/*
* The lock is neither released on exit nor on fork(). The lock is
@ -155,6 +155,8 @@ _PySSL_keylog_callback(const SSL *ssl, const char *line)
ssl_obj->ctx->keylog_filename);
ssl_obj->exc = PyErr_GetRaisedException();
}
done:
PyGILState_Release(threadstate);
}