fixed bug #34337 (possible NULL pointer in sys_check_timeouts)

This commit is contained in:
goldsimon 2011-09-20 07:21:19 +02:00
parent 5460900b14
commit 81a49a437a
2 changed files with 12 additions and 9 deletions

View File

@ -37,6 +37,9 @@ HISTORY
++ Bugfixes: ++ Bugfixes:
2011-09-20: Simon Goldschmidt
* timers.c: fixed bug #34337 (possible NULL pointer in sys_check_timeouts)
2011-09-11: Simon Goldschmidt 2011-09-11: Simon Goldschmidt
* tcp_out.c: use pcb->mss instead of TCP_MSS for preallocate mss-sized pbufs * tcp_out.c: use pcb->mss instead of TCP_MSS for preallocate mss-sized pbufs
(bug #34019) (bug #34019)

View File

@ -357,15 +357,15 @@ sys_untimeout(sys_timeout_handler handler, void *arg)
void void
sys_check_timeouts(void) sys_check_timeouts(void)
{ {
if (next_timeout) {
struct sys_timeo *tmptimeout; struct sys_timeo *tmptimeout;
u32_t diff; u32_t diff;
sys_timeout_handler handler; sys_timeout_handler handler;
void *arg; void *arg;
int had_one; u8_t had_one;
u32_t now; u32_t now;
now = sys_now(); now = sys_now();
if (next_timeout) {
/* this cares for wraparounds */ /* this cares for wraparounds */
diff = LWIP_U32_DIFF(now, timeouts_last_time); diff = LWIP_U32_DIFF(now, timeouts_last_time);
do do
@ -375,7 +375,7 @@ sys_check_timeouts(void)
#endif /* PBUF_POOL_FREE_OOSEQ */ #endif /* PBUF_POOL_FREE_OOSEQ */
had_one = 0; had_one = 0;
tmptimeout = next_timeout; tmptimeout = next_timeout;
if (tmptimeout->time <= diff) { if (tmptimeout && (tmptimeout->time <= diff)) {
/* timeout has expired */ /* timeout has expired */
had_one = 1; had_one = 1;
timeouts_last_time = now; timeouts_last_time = now;