{
tor_assert(desc);
digest256map_remove(hs_cache_v3_client, desc->key.pubkey);
+ /* Update cache size with this entry for the OOM handler. */
+ rend_cache_decrement_allocation(cache_get_client_entry_size(desc));
}
/* Store a given descriptor in our cache. */
}
/* Remove old entry. Make space for the new one! */
remove_v3_desc_as_client(cache_entry);
- rend_cache_decrement_allocation(cache_get_client_entry_size(cache_entry));
cache_client_desc_free(cache_entry);
}
bytes_removed += entry_size;
/* Entry is not in the cache anymore, destroy it. */
cache_client_desc_free(entry);
- /* Update our cache entry allocation size for the OOM. */
+ /* Update our OOM. We didn't use the remove() function because we are in
+ * a loop so we have to explicitely decrement. */
rend_cache_decrement_allocation(entry_size);
/* Logging. */
{