The code is deleting the first item after accessing
it, and then moving forward. It will eventually go
beyond the array and get NULL ptr and fail.
Instead we need to always get the first item,
since the array deletion is moving the queued items
forward.
Broken by
e18b4e41
/* flush the requests */
for (i = 0; i < count; i++) {
- auth_request = auth_requests[aqueue_idx(auth_failures, i)];
+ auth_request = auth_requests[aqueue_idx(auth_failures, 0)];
aqueue_delete_tail(auth_failures);
+ i_assert(auth_request != NULL);
i_assert(auth_request->state == AUTH_REQUEST_STATE_FINISHED);
auth_request_handler_reply(auth_request,
AUTH_CLIENT_RESULT_FAILURE,