Avoid leaking handles on MS-Windows.

src/w32proc.c (new_child): Avoid leaking handles if the subprocess
 resources were not orderly released.
This commit is contained in:
Eli Zaretskii 2013-02-18 18:38:50 +02:00
parent c1b9b2c27f
commit 17ddfd150f
2 changed files with 11 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2013-02-18 Eli Zaretskii <eliz@gnu.org>
* w32proc.c (new_child): Avoid leaking handles if the subprocess
resources were not orderly released.
2013-02-17 Eli Zaretskii <eliz@gnu.org>
* w32proc.c (new_child): Remove the loop that attempted to salvage

View file

@ -802,6 +802,12 @@ new_child (void)
cp = &child_procs[child_proc_count++];
Initialize:
/* Last opportunity to avoid leaking handles before we forget them
for good. */
if (cp->procinfo.hProcess)
CloseHandle (cp->procinfo.hProcess);
if (cp->procinfo.hThread)
CloseHandle (cp->procinfo.hThread);
memset (cp, 0, sizeof (*cp));
cp->fd = -1;
cp->pid = -1;