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

[tor-commits] [tor/release-0.3.4] Refrain from accessing empty smartlist in test_bridges_clear_bridge_list



commit 7bb3777dfbfe796fa4e430b18fd2ddfbba85b743
Author: rl1987 <rl1987@xxxxxxxxxxxxxxxx>
Date:   Sun Jun 3 13:34:24 2018 +0300

    Refrain from accessing empty smartlist in test_bridges_clear_bridge_list
    
    Just check that smartlist length is zero instead
---
 src/test/test_bridges.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/test/test_bridges.c b/src/test/test_bridges.c
index c4a4cacd9..c44f791e0 100644
--- a/src/test/test_bridges.c
+++ b/src/test/test_bridges.c
@@ -140,7 +140,6 @@ test_bridges_clear_bridge_list(void *arg)
   const smartlist_t *bridgelist;
   const smartlist_t *bridgelist_after;
   const bridge_info_t *bridge;
-  const bridge_info_t *bridge_after;
 
   helper_add_bridges_to_bridgelist(arg);
   bridgelist = bridge_list_get();
@@ -152,10 +151,7 @@ test_bridges_clear_bridge_list(void *arg)
   clear_bridge_list();
   bridgelist_after = bridge_list_get();
   tt_ptr_op(bridgelist_after, OP_NE, NULL);
-
-  bridge_after = smartlist_get(bridgelist, 0);
-  // There now shouldn't be a first bridge
-  tt_ptr_op(bridge_after, OP_EQ, NULL);
+  tt_int_op(smartlist_len(bridgelist_after), OP_EQ, 0);
 
  done:
   return;



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