diff options
author | Brad King <brad.king@kitware.com> | 2005-11-16 16:36:05 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2005-11-16 16:36:05 (GMT) |
commit | 5dae3d67f49099b77ba88d1c6739baea842ce4ad (patch) | |
tree | 6a281da505b683d25d307f9bc0fb96ee7b1021f9 /Source | |
parent | 1d4b3f8388fff8fb165d52b6ad6a5d7f6c35ec2c (diff) | |
download | CMake-5dae3d67f49099b77ba88d1c6739baea842ce4ad.zip CMake-5dae3d67f49099b77ba88d1c6739baea842ce4ad.tar.gz CMake-5dae3d67f49099b77ba88d1c6739baea842ce4ad.tar.bz2 |
BUG: Do not close handle obtained from GetModuleHandle which does not increase the reference count of the module.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/kwsys/ProcessWin32.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c index bb7e5fe..98a4802 100644 --- a/Source/kwsys/ProcessWin32.c +++ b/Source/kwsys/ProcessWin32.c @@ -2487,6 +2487,10 @@ static int kwsysProcess_List_NextProcess(kwsysProcess_List* self) /*--------------------------------------------------------------------------*/ static int kwsysProcess_List__New_NT4(kwsysProcess_List* self) { + /* Get a handle to the NT runtime module that should already be + loaded in this program. This does not actually increment the + reference count to the module so we do not need to close the + handle. */ HANDLE hNT = GetModuleHandle("ntdll.dll"); if(hNT) { @@ -2494,7 +2498,6 @@ static int kwsysProcess_List__New_NT4(kwsysProcess_List* self) self->P_ZwQuerySystemInformation = ((ZwQuerySystemInformationType) GetProcAddress(hNT, "ZwQuerySystemInformation")); - CloseHandle(hNT); } if(!self->P_ZwQuerySystemInformation) { @@ -2588,6 +2591,10 @@ static int kwsysProcess_List__GetParentId_NT4(kwsysProcess_List* self) /*--------------------------------------------------------------------------*/ static int kwsysProcess_List__New_Snapshot(kwsysProcess_List* self) { + /* Get a handle to the Windows runtime module that should already be + loaded in this program. This does not actually increment the + reference count to the module so we do not need to close the + handle. */ HANDLE hKernel = GetModuleHandle("kernel32.dll"); if(hKernel) { @@ -2600,7 +2607,6 @@ static int kwsysProcess_List__New_Snapshot(kwsysProcess_List* self) self->P_Process32Next = ((Process32NextType) GetProcAddress(hKernel, "Process32Next")); - CloseHandle(hKernel); } return (self->P_CreateToolhelp32Snapshot && self->P_Process32First && |