Skip to content

Commit 1e37e9e

Browse files
committed
SSLContext.load_dh_params() now properly closes the input file.
2 parents 14d080e + 457a229 commit 1e37e9e

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ Core and Builtins
217217
Library
218218
-------
219219

220+
- SSLContext.load_dh_params() now properly closes the input file.
221+
220222
- Issue #16829: IDLE printing no longer fails if there are spaces or other
221223
special characters in the file path.
222224

Modules/_ssl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,6 +2248,7 @@ load_dh_params(PySSLContext *self, PyObject *filepath)
22482248
errno = 0;
22492249
PySSL_BEGIN_ALLOW_THREADS
22502250
dh = PEM_read_DHparams(f, NULL, NULL, NULL);
2251+
fclose(f);
22512252
PySSL_END_ALLOW_THREADS
22522253
if (dh == NULL) {
22532254
if (errno != 0) {

0 commit comments

Comments
 (0)