Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit aebc049

Browse files
authoredJul 8, 2020
closes bpo-41235: Fix the error handling in SSLContext.load_dh_params() (pythonGH-21385)
1 parent 6f13adf commit aebc049

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
 
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

+4-2
Original file line numberDiff line numberDiff line change
@@ -4309,8 +4309,10 @@ _ssl__SSLContext_load_dh_params(PySSLContext *self, PyObject *filepath)
43094309
}
43104310
return NULL;
43114311
}
4312-
if (SSL_CTX_set_tmp_dh(self->ctx, dh) == 0)
4313-
_setSSLError(NULL, 0, __FILE__, __LINE__);
4312+
if (!SSL_CTX_set_tmp_dh(self->ctx, dh)) {
4313+
DH_free(dh);
4314+
return _setSSLError(NULL, 0, __FILE__, __LINE__);
4315+
}
43144316
DH_free(dh);
43154317
Py_RETURN_NONE;
43164318
}

0 commit comments

Comments
 (0)
Please sign in to comment.