summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS2
-rw-r--r--Modules/_ssl.c1
2 files changed, 3 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index c2a6802..6d82a76 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -217,6 +217,8 @@ Core and Builtins
Library
-------
+- SSLContext.load_dh_params() now properly closes the input file.
+
- Issue #16829: IDLE printing no longer fails if there are spaces or other
special characters in the file path.
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 0de541c..8212cd1 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -2248,6 +2248,7 @@ load_dh_params(PySSLContext *self, PyObject *filepath)
errno = 0;
PySSL_BEGIN_ALLOW_THREADS
dh = PEM_read_DHparams(f, NULL, NULL, NULL);
+ fclose(f);
PySSL_END_ALLOW_THREADS
if (dh == NULL) {
if (errno != 0) {