Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2012-03-19 21:34:23 +0400
committerCorinna Vinschen <corinna@vinschen.de>2012-03-19 21:34:23 +0400
commitd0d8b753505b467717cf7916adb9bc9336bd9e46 (patch)
tree1705219cf90aa3f0e4c9a13080cd7b406ee5a556 /winsup/cygwin/thread.cc
parentd9492ab8d2d7aa90f6ac0fe2928e001c5a4f01fa (diff)
* thread.cc (cancelable_wait): Don't malloc tbi, just make it a struct
on the stack to avoid memory leak.
Diffstat (limited to 'winsup/cygwin/thread.cc')
-rw-r--r--winsup/cygwin/thread.cc9
1 files changed, 4 insertions, 5 deletions
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);
}