From 5a6250fb06a0bc8eb77365334c9db883095cc34e Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Thu, 14 Nov 2002 23:33:48 +0000 Subject: [PATCH] Close the implicitely opened registry key. PR: 264 --- crypto/rand/rand_win.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crypto/rand/rand_win.c b/crypto/rand/rand_win.c index dfca0e0d5d..92befcd798 100644 --- a/crypto/rand/rand_win.c +++ b/crypto/rand/rand_win.c @@ -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); -- 2.25.1