* thread.cc (cancelable_wait): Don't malloc tbi, just make it a struct
on the stack to avoid memory leak.
This commit is contained in:
parent
d9492ab8d2
commit
d0d8b75350
|
@ -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>
|
2012-03-19 Christopher Faylor <me.cygwin2012@cgf.cx>
|
||||||
|
|
||||||
* pinfo.cc (pinfo::wait): Handle case where prefork was not called
|
* pinfo.cc (pinfo::wait): Handle case where prefork was not called
|
||||||
|
|
|
@ -982,15 +982,14 @@ cancelable_wait (HANDLE object, PLARGE_INTEGER timeout,
|
||||||
|
|
||||||
if (timeout)
|
if (timeout)
|
||||||
{
|
{
|
||||||
const size_t sizeof_tbi = sizeof (TIMER_BASIC_INFORMATION);
|
TIMER_BASIC_INFORMATION tbi;
|
||||||
PTIMER_BASIC_INFORMATION tbi = (PTIMER_BASIC_INFORMATION) malloc (sizeof_tbi);
|
|
||||||
|
|
||||||
NtQueryTimer (_my_tls.locals.cw_timer, TimerBasicInformation, tbi,
|
NtQueryTimer (_my_tls.locals.cw_timer, TimerBasicInformation, &tbi,
|
||||||
sizeof_tbi, NULL);
|
sizeof tbi, NULL);
|
||||||
/* if timer expired, TimeRemaining is negative and represents the
|
/* if timer expired, TimeRemaining is negative and represents the
|
||||||
system uptime when signalled */
|
system uptime when signalled */
|
||||||
if (timeout->QuadPart < 0LL)
|
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);
|
NtCancelTimer (_my_tls.locals.cw_timer, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue