diff options
author | Zackery Spytz <zspytz@gmail.com> | 2020-07-08 04:21:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-08 04:21:58 (GMT) |
commit | aebc0495572c5bb85d2bd97d27cf93ab038b5a6a (patch) | |
tree | f68d5abc131773703b63e6cf8a206d3d482e7ea8 /Modules | |
parent | 6f13adf59e6feb736d05ebe174bd793f4437a3d8 (diff) | |
download | cpython-aebc0495572c5bb85d2bd97d27cf93ab038b5a6a.zip cpython-aebc0495572c5bb85d2bd97d27cf93ab038b5a6a.tar.gz cpython-aebc0495572c5bb85d2bd97d27cf93ab038b5a6a.tar.bz2 |
closes bpo-41235: Fix the error handling in SSLContext.load_dh_params() (GH-21385)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ssl.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 5e82fe4..5806417 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -4309,8 +4309,10 @@ _ssl__SSLContext_load_dh_params(PySSLContext *self, PyObject *filepath) } return NULL; } - if (SSL_CTX_set_tmp_dh(self->ctx, dh) == 0) - _setSSLError(NULL, 0, __FILE__, __LINE__); + if (!SSL_CTX_set_tmp_dh(self->ctx, dh)) { + DH_free(dh); + return _setSSLError(NULL, 0, __FILE__, __LINE__); + } DH_free(dh); Py_RETURN_NONE; } |