Skip to content

Commit 44d3dc6

Browse files
authored
gh-142438: Added missing GIL release in _PySSL_keylog_callback when keylog_bio is unset (gh-142439)
1 parent 79aa43a commit 44d3dc6

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed a possible leaked GIL in _PySSL_keylog_callback.

Modules/_ssl/debughelpers.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ _PySSL_keylog_callback(const SSL *ssl, const char *line)
131131
PyThread_type_lock lock = get_state_sock(ssl_obj)->keylog_lock;
132132
assert(lock != NULL);
133133
if (ssl_obj->ctx->keylog_bio == NULL) {
134-
return;
134+
goto done;
135135
}
136136
/*
137137
* 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)
155155
ssl_obj->ctx->keylog_filename);
156156
ssl_obj->exc = PyErr_GetRaisedException();
157157
}
158+
159+
done:
158160
PyGILState_Release(threadstate);
159161
}
160162

0 commit comments

Comments
 (0)