The race condition is the timer elapses before isc__timer_create()
returns the pointer to the caller. Assigning the return pointer before
enabling the timer will fix it.
(cherry picked from commit
21966423cd7101a60ddfb3cf11f04f71c9fdd7b7)
result = schedule(timer, &now, true);
else
result = ISC_R_SUCCESS;
- if (result == ISC_R_SUCCESS)
+ if (result == ISC_R_SUCCESS) {
+ *timerp = (isc_timer_t *)timer;
APPEND(manager->timers, timer, link);
+ }
UNLOCK(&manager->lock);
return (result);
}
- *timerp = (isc_timer_t *)timer;
-
return (ISC_R_SUCCESS);
}