From: Arran Cudbard-Bell Date: Wed, 11 Jul 2018 22:29:21 +0000 (-0400) Subject: Fix dlist entry mangling X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dcbe0d277ad2cdd462cdb74bd175ebd9d55310f3;p=thirdparty%2Ffreeradius-server.git Fix dlist entry mangling --- diff --git a/src/main/state.c b/src/main/state.c index 9b2d175d02b..7344e7ad5ea 100644 --- a/src/main/state.c +++ b/src/main/state.c @@ -311,11 +311,12 @@ static fr_state_entry_t *state_entry_create(fr_state_tree_t *state, REQUEST *req /* * Clean up old entries. */ - for (next = FR_DLIST_FIRST(state->to_expire); - next; - next = FR_DLIST_NEXT(state->to_expire, next)) { + next = FR_DLIST_FIRST(state->to_expire); + while (next) { entry = fr_ptr_to_type(fr_state_entry_t, list, next); (void)talloc_get_type_abort(entry, fr_state_entry_t); /* Allow examination */ + next = FR_DLIST_NEXT(state->to_expire, next); /* Advance *before* potential unlinking */ + if (entry == old) continue; /*