8000 closes bpo-41235: Fix the error handling in SSLContext.load_dh_params… · python/cpython@c8c818b · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit c8c818b

Browse files
closes bpo-41235: Fix the error handling in SSLContext.load_dh_params() (GH-21389)
(cherry picked from commit aebc049) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
1 parent 110dd15 commit c8c818b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix the error handling in :meth:`ssl.SSLContext.load_dh_params`.

Modules/_ssl.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4189,8 +4189,10 @@ _ssl__SSLContext_load_dh_params(PySSLContext *self, PyObject *filepath)
41894189
}
41904190
return NULL;
41914191
}
4192-
if (SSL_CTX_set_tmp_dh(self->ctx, dh) == 0)
4193-
_setSSLError(NULL, 0, __FILE__, __LINE__);
4192+
if (!SSL_CTX_set_tmp_dh(self->ctx, dh)) {
4193+
DH_free(dh);
4194+
return _setSSLError(NULL, 0, __FILE__, __LINE__);
4195+
}
41944196
DH_free(dh);
41954197
Py_RETURN_NONE;
41964198
}

0 commit comments

Comments
 (0)
0