]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add test to verify that unused pointers are NULL.
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sat, 13 Apr 2019 14:54:05 +0000 (16:54 +0200)
committerNick Mathewson <nickm@torproject.org>
Mon, 15 Apr 2019 18:46:26 +0000 (14:46 -0400)
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@stoeckmann.org>
src/test/test_containers.c

index 7892a0885386d96ce3b6831d5a267c8aa6fd814d..ad272eeaf59b4510d131992da3a7972fef424732 100644 (file)
@@ -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);