diff --git a/Misc/NEWS.d/next/Windows/2019-07-29-16-49-31.bpo-37702.Lj2f5e.rst b/Misc/NEWS.d/next/Windows/2019-07-29-16-49-31.bpo-37702.Lj2f5e.rst new file mode 100644 index 000000000000000..67d53d4c46276be --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2019-07-29-16-49-31.bpo-37702.Lj2f5e.rst @@ -0,0 +1,2 @@ +Fix memory leak on Windows in creating an SSLContext object or +running urllib.request.urlopen('https://...'). \ No newline at end of file diff --git a/Modules/_ssl.c b/Modules/_ssl.c index b079663cc2235be..91820fe9529d1e4 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -5448,6 +5448,7 @@ ssl_collect_certificates(const char *store_name) if (result) { ++storesAdded; } + CertCloseStore(hSystemStore, 0); /* flag must be 0 */ } } if (storesAdded == 0) {