Commit 47f1d19f authored by David Goulet's avatar David Goulet 🆘
Browse files

test: Increment rend cache allocation before freeing

The rend_cache/entry_free was missing the rend cache allocation increment
before freeing the object.

Without it, it had an underflow bug:

  Sep 17 08:40:13.845 [warn] rend_cache_decrement_allocation(): Bug: Underflow
  in rend_cache_decrement_allocation (on Tor 0.4.5.0-alpha-dev
  7eef9ced

)

Fixes #40125
Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
parent 72484a49
Pipeline #1055 passed with stage
in 22 minutes and 57 seconds
o Testing (onion service v2):
- Fix a rendezvous cache unit test that was triggering an underflow on the
global rend cache allocation. Fixes bug 40125; bugfix on
0.2.8.1-alpha.
......@@ -978,11 +978,13 @@ test_rend_cache_entry_free(void *data)
// Handles NULL descriptor correctly
e = tor_malloc_zero(sizeof(rend_cache_entry_t));
rend_cache_increment_allocation(rend_cache_entry_allocation(e));
rend_cache_entry_free(e);
// Handles non-NULL descriptor correctly
e = tor_malloc_zero(sizeof(rend_cache_entry_t));
e->desc = tor_malloc(10);
rend_cache_increment_allocation(rend_cache_entry_allocation(e));
rend_cache_entry_free(e);
/* done: */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment