summaryrefslogtreecommitdiffstats
path: root/Modules/_ssl.c
diff options
context:
space:
mode:
authorneonene <53406459+neonene@users.noreply.github.com>2019-09-09 12:33:43 (GMT)
committerSteve Dower <steve.dower@python.org>2019-09-09 12:33:43 (GMT)
commited70129e15ea028469145111044a4349960a4e6f (patch)
tree460ba098e0afe9dab035f62e1f08f67d074a82d4 /Modules/_ssl.c
parentb4612f5d54aced5bc37f1b85bf50b4cafa2480f0 (diff)
downloadcpython-ed70129e15ea028469145111044a4349960a4e6f.zip
cpython-ed70129e15ea028469145111044a4349960a4e6f.tar.gz
cpython-ed70129e15ea028469145111044a4349960a4e6f.tar.bz2
bpo-37702: Fix SSL's certificate-store leak on Windows (GH-15632)
ssl_collect_certificates function in _ssl.c has a memory leak. Calling CertOpenStore() and CertAddStoreToCollection(), a store's refcnt gets incremented by 2. But CertCloseStore() is called only once and the refcnt leaves 1.
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r--Modules/_ssl.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 3d63612..d94efa9 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -5581,6 +5581,7 @@ ssl_collect_certificates(const char *store_name)
if (result) {
++storesAdded;
}
+ CertCloseStore(hSystemStore, 0); /* flag must be 0 */
}
}
if (storesAdded == 0) {