There was an error while loading. Please reload this page.
1 parent 6f13adf commit aebc049Copy full SHA for aebc049
2 files changed
Misc/NEWS.d/next/Library/2020-07-07-21-56-26.bpo-41235.H2csMU.rst
@@ -0,0 +1 @@
1
+Fix the error handling in :meth:`ssl.SSLContext.load_dh_params`.
Modules/_ssl.c
@@ -4309,8 +4309,10 @@ _ssl__SSLContext_load_dh_params(PySSLContext *self, PyObject *filepath)
4309
}
4310
return NULL;
4311
4312
- if (SSL_CTX_set_tmp_dh(self->ctx, dh) == 0)
4313
- _setSSLError(NULL, 0, __FILE__, __LINE__);
+ if (!SSL_CTX_set_tmp_dh(self->ctx, dh)) {
+ DH_free(dh);
4314
+ return _setSSLError(NULL, 0, __FILE__, __LINE__);
4315
+ }
4316
DH_free(dh);
4317
Py_RETURN_NONE;
4318
0 commit comments