From a9265258af9597f3a69bcb8dadfc94cc6afdf0c7 Mon Sep 17 00:00:00 2001 From: Noah Misch Date: Sat, 3 Dec 2016 15:46:35 -0500 Subject: [PATCH] Remove wrong CloseHandle() call. In accordance with its own documentation, invoke CloseHandle() only when directed in the documentation for the function that furnished the handle. GetModuleHandle() does not so direct. We have been issuing this call only in the rare event that a CRT DLL contains no "_putenv" symbol, so lack of bug reports is uninformative. Back-patch to 9.2 (all supported versions). Christian Ullrich, reviewed by Michael Paquier. --- src/port/win32env.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/port/win32env.c b/src/port/win32env.c index e934a8f76d3..40df88990fd 100644 --- a/src/port/win32env.c +++ b/src/port/win32env.c @@ -86,7 +86,6 @@ pgwin32_putenv(const char *envval) rtmodules[i].putenvFunc = (PUTENVPROC) GetProcAddress(rtmodules[i].hmodule, "_putenv"); if (rtmodules[i].putenvFunc == NULL) { - CloseHandle(rtmodules[i].hmodule); rtmodules[i].hmodule = INVALID_HANDLE_VALUE; continue; }