FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.14] gh-159739: Release SSL resources on error paths (GH-159745) by miss-islington · Pull Request #159762 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (2) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
gh-159739: Release SSL resources on error paths (GH-159745)
Free decoded subject alternative names when certificate conversion
fails, and close the key log file if the BIO allocation fails.

Backport to 3.15 and 3.14.
(cherry picked from commit b2b0a33)

Co-authored-by: Jelle Zijlstra <jelle@openai.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
  • Loading branch information
2 people authored and miss-islington committed Oct 19, 2026
commit c4179dd3123cb401635b342eb0f45c688ac7e0f1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix resource leaks in :mod:`ssl` when certificate conversion or key log setup
fails.
1 change: 1 addition & 0 deletions Modules/_ssl.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,7 @@ _get_peer_alt_names (_sslmodulestate *state, X509 *certificate) {


fail:
sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free);
if (biobuf != NULL)
BIO_free(biobuf);

Expand Down
1 change: 1 addition & 0 deletions Modules/_ssl/debughelpers.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ _PySSLContext_set_keylog_filename(PyObject *op, PyObject *arg,

self->keylog_bio = BIO_new_fp(fp, BIO_CLOSE | BIO_FP_TEXT);
if (self->keylog_bio == NULL) {
fclose(fp);
PyErr_SetString(get_state_ctx(self)->PySSLErrorObject,
"Can't malloc memory for keylog file");
return -1;
Expand Down
Loading

Back | FazBrowse Home | New Git URL