Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cb2ad80 commit d50c3f3Copy full SHA for d50c3f3
1 file changed
Python/random.c
@@ -15,8 +15,6 @@ static int _Py_HashSecret_Initialized = 0;
15
#endif
16
17
#ifdef MS_WINDOWS
18
-/* This handle is never explicitly released. Instead, the operating
19
- system will release it when the process terminates. */
20
static HCRYPTPROV hCryptProv = 0;
21
22
static int
@@ -298,7 +296,12 @@ _PyRandom_Init(void)
298
296
void
299
297
_PyRandom_Fini(void)
300
{
301
-#ifndef MS_WINDOWS
+#ifdef MS_WINDOWS
+ if (hCryptProv) {
+ CloseHandle(hCryptProv);
302
+ hCryptProv = 0;
303
+ }
304
+#else
305
dev_urandom_close();
306
307
}
0 commit comments