diff options
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/thread.cc | 9 |
2 files changed, 9 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3c25957d1..8430abdae 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2012-03-19 Corinna Vinschen <corinna@vinschen.de> + + * thread.cc (cancelable_wait): Don't malloc tbi, just make it a struct + on the stack to avoid memory leak. + 2012-03-19 Christopher Faylor <me.cygwin2012@cgf.cx> * pinfo.cc (pinfo::wait): Handle case where prefork was not called diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 513b860d1..af0d6afc7 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -982,15 +982,14 @@ cancelable_wait (HANDLE object, PLARGE_INTEGER timeout, if (timeout) { - const size_t sizeof_tbi = sizeof (TIMER_BASIC_INFORMATION); - PTIMER_BASIC_INFORMATION tbi = (PTIMER_BASIC_INFORMATION) malloc (sizeof_tbi); + TIMER_BASIC_INFORMATION tbi; - NtQueryTimer (_my_tls.locals.cw_timer, TimerBasicInformation, tbi, - sizeof_tbi, NULL); + NtQueryTimer (_my_tls.locals.cw_timer, TimerBasicInformation, &tbi, + sizeof tbi, NULL); /* if timer expired, TimeRemaining is negative and represents the system uptime when signalled */ if (timeout->QuadPart < 0LL) - timeout->QuadPart = tbi->SignalState ? 0LL : tbi->TimeRemaining.QuadPart; + timeout->QuadPart = tbi.SignalState ? 0LL : tbi.TimeRemaining.QuadPart; NtCancelTimer (_my_tls.locals.cw_timer, NULL); } |