From 094a2a17ad1cd65909fa2eee648d049d8d69fc45 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 6 Mar 2019 22:17:32 +0100 Subject: Cygwin: posix timers: fix resource leak On setting the timer, the thread is accidentally only canceled when disarming the timer. This leaks one thread per timer_settimer call. Move the thread cancellation where it belongs. Signed-off-by: Corinna Vinschen --- winsup/cygwin/posix_timer.cc | 2 +- winsup/cygwin/release/3.0.3 | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 winsup/cygwin/release/3.0.3 diff --git a/winsup/cygwin/posix_timer.cc b/winsup/cygwin/posix_timer.cc index d9d4a9a..a140b00 100644 --- a/winsup/cygwin/posix_timer.cc +++ b/winsup/cygwin/posix_timer.cc @@ -287,9 +287,9 @@ timer_tracker::settime (int flags, const itimerspec *new_value, if (old_value) gettime (old_value, false); + cancel (); if (!new_value->it_value.tv_sec && !new_value->it_value.tv_nsec) { - cancel (); memset (&time_spec, 0, sizeof time_spec); interval = 0; exp_ts = 0; diff --git a/winsup/cygwin/release/3.0.3 b/winsup/cygwin/release/3.0.3 new file mode 100644 index 0000000..66ae639 --- /dev/null +++ b/winsup/cygwin/release/3.0.3 @@ -0,0 +1,13 @@ +What's new: +----------- + + +What changed: +------------- + + +Bug Fixes +--------- + +- Fix a resource leak in posix timers. + Addresses: https://cygwin.com/ml/cygwin/2019-03/msg00120.html -- cgit v1.1