[cmake-commits] hoffman committed ProcessWin32.c 1.67 1.68
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Jul 24 10:05:33 EDT 2007
Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv12719
Modified Files:
ProcessWin32.c
Log Message:
ENH: fix resource leak
Index: ProcessWin32.c
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/ProcessWin32.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- ProcessWin32.c 12 Apr 2007 14:56:20 -0000 1.67
+++ ProcessWin32.c 24 Jul 2007 14:05:31 -0000 1.68
@@ -1453,7 +1453,6 @@
void kwsysProcess_Kill(kwsysProcess* cp)
{
int i;
-
/* Make sure we are executing a process. */
if(!cp || cp->State != kwsysProcess_State_Executing || cp->TimeoutExpired ||
cp->Killed)
@@ -1485,7 +1484,10 @@
/* Not Windows 9x. Just terminate the children. */
for(i=0; i < cp->NumberOfCommands; ++i)
{
- kwsysProcessKillTree(cp->ProcessInformation[i].dwProcessId);
+ kwsysProcessKillTree(cp->ProcessInformation[i].dwProcessId);
+ // close the handle if we kill it
+ kwsysProcessCleanupHandle(&cp->ProcessInformation[i].hThread);
+ kwsysProcessCleanupHandle(&cp->ProcessInformation[i].hProcess);
}
}
@@ -1851,7 +1853,6 @@
r = CreateProcess(0, realCommand, 0, 0, TRUE,
cp->Win9x? 0 : CREATE_SUSPENDED, 0, 0,
&si->StartupInfo, &cp->ProcessInformation[index]);
-
if(cp->Win9x)
{
/* Free memory. */
@@ -2114,7 +2115,6 @@
void kwsysProcessCleanup(kwsysProcess* cp, int error)
{
int i;
-
/* If this is an error case, report the error. */
if(error)
{
@@ -2861,6 +2861,7 @@
{
TerminateProcess(h, 255);
WaitForSingleObject(h, INFINITE);
+ CloseHandle(h);
}
}
More information about the Cmake-commits
mailing list