summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-05-24 14:13:18 (GMT)
committerBrad King <brad.king@kitware.com>2006-05-24 14:13:18 (GMT)
commit9b74e597bea979229d87ede77e8af2c241e3f45e (patch)
tree16b4d3df3b0d526fa2648f7861f5d2837a4b4452 /Source
parent2cae0ce38974a97965057993538a9a6f4cf92141 (diff)
downloadCMake-9b74e597bea979229d87ede77e8af2c241e3f45e.zip
CMake-9b74e597bea979229d87ede77e8af2c241e3f45e.tar.gz
CMake-9b74e597bea979229d87ede77e8af2c241e3f45e.tar.bz2
BUG: Do not leak global table of processes.
Diffstat (limited to 'Source')
-rw-r--r--Source/kwsys/ProcessUNIX.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c
index 100a495..49b939e 100644
--- a/Source/kwsys/ProcessUNIX.c
+++ b/Source/kwsys/ProcessUNIX.c
@@ -2213,9 +2213,6 @@ static void kwsysProcessesRemove(kwsysProcess* cp)
newProcesses.Processes[i] = newProcesses.Processes[i+1];
}
- /* Store the new set in that seen by the signal handler. */
- kwsysProcessesUpdate(&newProcesses);
-
/* If this was the last process, disable the signal handler. */
if(newProcesses.Count == 0)
{
@@ -2223,7 +2220,16 @@ static void kwsysProcessesRemove(kwsysProcess* cp)
interrupted. */
while((sigaction(SIGCHLD, &kwsysProcessesOldSigChldAction, 0) < 0) &&
(errno == EINTR));
+
+ /* Free the table of process pointers since it is now empty.
+ This is safe because the signal handler has been removed. */
+ newProcesses.Size = 0;
+ free(newProcesses.Processes);
+ newProcesses.Processes = 0;
}
+
+ /* Store the new set in that seen by the signal handler. */
+ kwsysProcessesUpdate(&newProcesses);
}
}