[PATCH] Cygwin: pty: Add missing CloseHandle() calls.
Corinna Vinschen
corinna-cygwin@cygwin.com
Mon Jan 13 15:56:00 GMT 2020
Hi Takashi,
On Jan 1 15:48, Takashi Yano wrote:
> ---
> winsup/cygwin/fhandler_tty.cc | 22 ++++++++++++++++++++--
> 1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
> index 65b12fd6c..23156f977 100644
> --- a/winsup/cygwin/fhandler_tty.cc
> +++ b/winsup/cygwin/fhandler_tty.cc
> @@ -2242,11 +2242,27 @@ fhandler_pty_master::close ()
> /* Terminate helper process */
> SetEvent (get_ttyp ()->h_helper_goodbye);
> WaitForSingleObject (get_ttyp ()->h_helper_process, INFINITE);
> + CloseHandle (get_ttyp ()->h_helper_goodbye);
> + CloseHandle (get_ttyp ()->h_helper_process);
> /* FIXME: Pseudo console can be accessed via its handle
> only in the process which created it. What else can we do? */
> if (master_pid_tmp == myself->pid)
> - /* Release pseudo console */
> - ClosePseudoConsole (get_pseudo_console ());
> + {
> + /* ClosePseudoConsole() seems to have a bug that one
> + internal handle remains opened. This causes handle leak.
> + This is a workaround for this problem. */
> + typedef struct
> + {
> + HANDLE hWritePipe;
> + HANDLE hConDrvReference;
> + HANDLE hConHostProcess;
> + } HPCON_INTERNAL;
Can you please move this struct to some header? Even if it's not a
really close match, maybe ntdll.h works best, combined with a short
comment what this is about...
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20200113/fb200595/attachment.sig>
More information about the Cygwin-patches
mailing list