]> granicus.if.org Git - python/commitdiff
SSLContext.load_dh_params() now properly closes the input file.
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 12 Jan 2013 20:43:45 +0000 (21:43 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 12 Jan 2013 20:43:45 +0000 (21:43 +0100)
Misc/NEWS
Modules/_ssl.c

index 1e4dea2f85c596c396e5975d595a207d33c29396..76f71b4425f79d622d51ae05bcc64fc4f13bfd0f 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -147,6 +147,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.
 
index ad22c5299ce4732f27fa1e8a10a796bede449095..abb48b976afd2fde7e48e33a857086ae571a8abb 100644 (file)
@@ -2177,6 +2177,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) {