mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-12 12:09:18 +08:00
Cygwin: pty: Fix memory leak in master_fwd_thread.
- If master_fwd_thread is terminated by cygthread::terminate_thread(), the opportunity to release tmp_pathbuf is missed, resulting in a memory leak. This patch fixes the issue.
This commit is contained in:
parent
aa49985245
commit
4f490c4cef
@ -2106,7 +2106,9 @@ fhandler_pty_master::close ()
|
|||||||
master_ctl = NULL;
|
master_ctl = NULL;
|
||||||
}
|
}
|
||||||
release_output_mutex ();
|
release_output_mutex ();
|
||||||
master_fwd_thread->terminate_thread ();
|
get_ttyp ()->stop_fwd_thread = true;
|
||||||
|
WriteFile (to_master_nat, "", 0, NULL, NULL);
|
||||||
|
master_fwd_thread->detach ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (InterlockedDecrement (&master_cnt) == 0)
|
if (InterlockedDecrement (&master_cnt) == 0)
|
||||||
@ -2695,6 +2697,8 @@ fhandler_pty_master::pty_master_fwd_thread (const master_fwd_thread_param_t *p)
|
|||||||
termios_printf ("ReadFile for forwarding failed, %E");
|
termios_printf ("ReadFile for forwarding failed, %E");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (p->ttyp->stop_fwd_thread)
|
||||||
|
break;
|
||||||
ssize_t wlen = rlen;
|
ssize_t wlen = rlen;
|
||||||
char *ptr = outbuf;
|
char *ptr = outbuf;
|
||||||
if (p->ttyp->pcon_activated)
|
if (p->ttyp->pcon_activated)
|
||||||
|
@ -254,6 +254,7 @@ tty::init ()
|
|||||||
last_sig = 0;
|
last_sig = 0;
|
||||||
mask_flusho = false;
|
mask_flusho = false;
|
||||||
discard_input = false;
|
discard_input = false;
|
||||||
|
stop_fwd_thread = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE
|
HANDLE
|
||||||
|
@ -132,6 +132,7 @@ private:
|
|||||||
xfer_dir pcon_input_state;
|
xfer_dir pcon_input_state;
|
||||||
bool mask_flusho;
|
bool mask_flusho;
|
||||||
bool discard_input;
|
bool discard_input;
|
||||||
|
bool stop_fwd_thread;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HANDLE from_master_nat () const { return _from_master_nat; }
|
HANDLE from_master_nat () const { return _from_master_nat; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user