Skip to content

Commit

Permalink
tm: safe list iteration in tm_clean_lifetime()
Browse files Browse the repository at this point in the history
(cherry picked from commit 325a45e)
  • Loading branch information
miconda committed Mar 9, 2020
1 parent 15ff3bb commit 575ab95
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modules/tm/h_table.c
Expand Up @@ -596,6 +596,7 @@ void tm_clean_lifetime(void)
{
int r;
tm_cell_t *tcell;
tm_cell_t *bcell;
ticks_t texp;

texp = get_ticks_raw() - S_TO_TICKS(TM_LIFETIME_LIMIT);
Expand All @@ -612,7 +613,7 @@ void tm_clean_lifetime(void)
continue;
}

clist_foreach(&_tm_table->entries[r], tcell, next_c)
clist_foreach_safe(&_tm_table->entries[r], tcell, bcell, next_c)
{
if(TICKS_GT(texp, tcell->end_of_life)) {
tm_log_transaction(tcell, L_WARN, "[hard cleanup]");
Expand Down

0 comments on commit 575ab95

Please sign in to comment.