]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix eviction corner case
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 22 Jul 2019 15:10:20 +0000 (16:10 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 22 Jul 2019 15:10:20 +0000 (16:10 +0100)
Issue: #2991

src/libutil/hash.c

index 56e80a17e2f764280ab445c065c8a3713f7008cb..09d3a29c14af0c8a8d9c9b8f040a956e442b3bdd 100644 (file)
@@ -481,6 +481,10 @@ rspamd_lru_hash_evict (rspamd_lru_hash_t *hash, time_t now)
                                }
                        }
                });
+
+               if (selected) {
+                       elt = selected;
+               }
        }
        else {
                /* Fast random eviction */
@@ -493,6 +497,7 @@ rspamd_lru_hash_evict (rspamd_lru_hash_t *hash, time_t now)
                }
        }
 
+       /* Evict if nothing else has been cleaned */
        if (elt && nexpired == 0) {
                rspamd_lru_hash_remove_node (hash, elt);
        }