BUG: Do not leak global table of processes.
This commit is contained in:
parent
2cae0ce389
commit
9b74e597be
|
@ -2213,9 +2213,6 @@ static void kwsysProcessesRemove(kwsysProcess* cp)
|
||||||
newProcesses.Processes[i] = newProcesses.Processes[i+1];
|
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 this was the last process, disable the signal handler. */
|
||||||
if(newProcesses.Count == 0)
|
if(newProcesses.Count == 0)
|
||||||
{
|
{
|
||||||
|
@ -2223,7 +2220,16 @@ static void kwsysProcessesRemove(kwsysProcess* cp)
|
||||||
interrupted. */
|
interrupted. */
|
||||||
while((sigaction(SIGCHLD, &kwsysProcessesOldSigChldAction, 0) < 0) &&
|
while((sigaction(SIGCHLD, &kwsysProcessesOldSigChldAction, 0) < 0) &&
|
||||||
(errno == EINTR));
|
(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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue