Browse Source

eloop: Fix timeout handler to use local copy of func pointer

We need to copy not only the context pointers, but also the function
pointer before the timeout gets freed.
Jouni Malinen 15 years ago
parent
commit
459489c99d
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/utils/eloop.c

+ 3 - 2
src/utils/eloop.c

@@ -534,9 +534,10 @@ void eloop_run(void)
 			if (!os_time_before(&now, &timeout->time)) {
 				void *eloop_data = timeout->eloop_data;
 				void *user_data = timeout->user_data;
+				eloop_timeout_handler handler =
+					timeout->handler;
 				eloop_remove_timeout(timeout);
-				timeout->handler(eloop_data,
-						 user_data);
+				handler(eloop_data, user_data);
 			}
 
 		}