closes bpo-41235: Fix the error handling in SSLContext.load_dh_params() (GH-21385)

(cherry picked from commit aebc049557)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
This commit is contained in:
Miss Islington (bot) 2020-07-07 21:40:18 -07:00 committed by GitHub
parent 366cfc65f2
commit 1d1c574340
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -0,0 +1 @@
Fix the error handling in :meth:`ssl.SSLContext.load_dh_params`.

View File

@ -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;
}