[tor-commits] [tor/master] Add test to verify that unused pointers are NULL.

dgoulet at torproject.org dgoulet at torproject.org
Wed Apr 24 13:58:14 UTC 2019


commit 5a0c8579964aa1d27dd9be35afda5e7226c31fb4
Author: Tobias Stoeckmann <tobias at stoeckmann.org>
Date:   Sat Apr 13 16:54:05 2019 +0200

    Add test to verify that unused pointers are NULL.
    
    The smartlist code takes great care to set all unused pointers inside
    the smartlist memory to NULL. Check if this is also the case after
    modifying the smartlist multiple times.
    
    Signed-off-by: Tobias Stoeckmann <tobias at stoeckmann.org>
---
 src/test/test_containers.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/test/test_containers.c b/src/test/test_containers.c
index 7892a0885..ad272eeaf 100644
--- a/src/test/test_containers.c
+++ b/src/test/test_containers.c
@@ -1006,6 +1006,7 @@ test_container_smartlist_remove(void *arg)
   tt_ptr_op(smartlist_get(sl, 1), OP_EQ, &array[2]);
   tt_ptr_op(smartlist_get(sl, 2), OP_EQ, &array[1]);
   tt_ptr_op(smartlist_get(sl, 3), OP_EQ, &array[2]);
+  tt_ptr_op(sl->list[4], OP_EQ, NULL);
 
  done:
   smartlist_free(sl);





More information about the tor-commits mailing list