Parcourir la 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 il y a 15 ans
Parent
commit
459489c99d
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  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);
 			}
 
 		}