aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_rendcache.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2020-09-17 12:55:40 -0400
committerDavid Goulet <dgoulet@torproject.org>2020-09-17 13:00:23 -0400
commit47f1d19f8e6e1795ad7a73cb96bf44f355442e85 (patch)
tree3355473ae43460bcdf6d2cce8e14ed82b354da1d /src/test/test_rendcache.c
parent72484a4953d744754b3b6b025242ef668e3f017a (diff)
downloadtor-47f1d19f8e6e1795ad7a73cb96bf44f355442e85.tar.gz
tor-47f1d19f8e6e1795ad7a73cb96bf44f355442e85.zip
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 7eef9ced61e72b1d) Fixes #40125 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/test/test_rendcache.c')
-rw-r--r--src/test/test_rendcache.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/test/test_rendcache.c b/src/test/test_rendcache.c
index 93f9f82953..92e135f3b1 100644
--- a/src/test/test_rendcache.c
+++ b/src/test/test_rendcache.c
@@ -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: */