- Fix for #1032, add safeguard to make table space positive.

This commit is contained in:
W.C.A. Wijngaards 2024-03-27 11:49:20 +01:00
parent eb3e1ae24f
commit 3ea078baf6
2 changed files with 4 additions and 1 deletions

View file

@ -2,6 +2,7 @@
- Fix name of unit test for subnet cache response.
- Fix #1032: The size of subnet_msg_cache calculation mistake cause
memory usage increased beyond expectations.
- Fix for #1032, add safeguard to make table space positive.
25 March 2024: Yorgos
- Merge #831 from Pierre4012: Improve Windows NSIS installer

View file

@ -543,7 +543,9 @@ lruhash_update_space_used(struct lruhash* table, void* cb_arg, int diff_size)
/* find bin */
lock_quick_lock(&table->lock);
table->space_used = (size_t)((int)table->space_used + diff_size);
if((int)table->space_used + diff_size < 0)
table->space_used = 0;
else table->space_used = (size_t)((int)table->space_used + diff_size);
if(table->space_used > table->space_max)
reclaim_space(table, &reclaimlist);