[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Avoid relying on malloc internals in test_rend_cache_purge.



commit 7ff18cc1b64e4a119ec3b46102c897f3ca7107f8
Author: teor (Tim Wilson-Brown) <teor2345@xxxxxxxxx>
Date:   Tue Dec 1 10:50:14 2015 +1100

    Avoid relying on malloc internals in test_rend_cache_purge.
    
    Closes ticket 17724. Bug fix on ade5005853c1 and 5e9f2384cf0f,
    not in any released version of Tor. Patch by "teor".
---
 changes/bug17724          |    4 ++++
 src/test/test_rendcache.c |    8 +++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/changes/bug17724 b/changes/bug17724
new file mode 100644
index 0000000..7ace99e
--- /dev/null
+++ b/changes/bug17724
@@ -0,0 +1,4 @@
+  o Minor bug fixes (unit tests, hidden services):
+    - Avoid relying on malloc internals in test_rend_cache_purge.
+      Closes ticket 17724. Bug fix on ade5005853c1 and 5e9f2384cf0f,
+      not in any released version of Tor. Patch by "teor".
diff --git a/src/test/test_rendcache.c b/src/test/test_rendcache.c
index 11f1114..92adf01 100644
--- a/src/test/test_rendcache.c
+++ b/src/test/test_rendcache.c
@@ -1024,24 +1024,22 @@ test_rend_cache_entry_free(void *data)
 static void
 test_rend_cache_purge(void *data)
 {
-  strmap_t *our_rend_cache;
-
   (void)data;
 
   // Deals with a NULL rend_cache
   rend_cache_purge();
   tt_assert(rend_cache);
-  tt_int_op(strmap_size(rend_cache), OP_EQ, 0);
+  tt_assert(strmap_size(rend_cache) == 0);
 
   // Deals with existing rend_cache
   rend_cache_free_all();
   rend_cache_init();
+  tt_assert(rend_cache);
+  tt_assert(strmap_size(rend_cache) == 0);
 
-  our_rend_cache = rend_cache;
   rend_cache_purge();
   tt_assert(rend_cache);
   tt_assert(strmap_size(rend_cache) == 0);
-  tt_assert(rend_cache == our_rend_cache);
 
  done:
   rend_cache_free_all();



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits