Skip to content

Commit b2152cb

Browse files
authored
Refactor keylog handling to use goto for cleanup
1 parent 6af3c8b commit b2152cb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Modules/_ssl/debughelpers.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +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-
PyGILState_Release(threadstate);
135-
return;
134+
goto done;
136135
}
137136
/*
138137
* The lock is neither released on exit nor on fork(). The lock is
@@ -156,6 +155,7 @@ _PySSL_keylog_callback(const SSL *ssl, const char *line)
156155
ssl_obj->ctx->keylog_filename);
157156
ssl_obj->exc = PyErr_GetRaisedException();
158157
}
158+
done:
159159
PyGILState_Release(threadstate);
160160
}
161161

0 commit comments

Comments
 (0)