Close the implicitely opened registry key.
authorRichard Levitte <levitte@openssl.org>
Thu, 14 Nov 2002 23:33:48 +0000 (23:33 +0000)
committerRichard Levitte <levitte@openssl.org>
Thu, 14 Nov 2002 23:33:48 +0000 (23:33 +0000)
PR: 264

crypto/rand/rand_win.c

index dfca0e0d5d49515d27e4ef0e78c4695135e45808..92befcd798cfcdecd5df4483e50ea458ab3e628f 100644 (file)
@@ -287,9 +287,18 @@ int RAND_poll(void)
                        {
                         /* For entropy count assume only least significant
                         * byte of each DWORD is random.
-                         */
+                        */
                        RAND_add(&length, sizeof(length), 0);
                        RAND_add(buf, length, length / 4.0);
+
+                       /* Close the Registry Key to allow Windows to cleanup/close
+                        * the open handle
+                        * Note: The 'HKEY_PERFORMANCE_DATA' key is implicitly opened
+                        *       when the RegQueryValueEx above is done.  However, if
+                        *       it is not explicitly closed, it can cause disk
+                        *       partition manipulation problems.
+                        */
+                       RegCloseKey(HKEY_PERFORMANCE_DATA);
                        }
                if (buf)
                        free(buf);