Commit 013d149
committed
Fix LRU single-entry eviction
Evicting the only node in an LRU queue cleared the front pointer but left the end pointer referencing the removed node. A later empty eviction could see stale queue state and risk acting on an already removed entry.
The removal path now clears queue->end when removing the last node, keeping the empty queue state consistent.
Added an LRU unit test that evicts a single entry, verifies both queue ends are NULL, and confirms a second empty eviction does not run cleanup again.1 parent f9bd494 commit 013d149
2 files changed
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
| 269 | + | |
268 | 270 | | |
269 | 271 | | |
270 | 272 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
55 | 81 | | |
56 | 82 | | |
57 | 83 | | |
| |||
173 | 199 | | |
174 | 200 | | |
175 | 201 | | |
| 202 | + | |
176 | 203 | | |
177 | 204 | | |
178 | 205 | | |
| |||
0 commit comments