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

[tor-commits] [tor/master] Update address tests to avoid offending coverity.



commit 3e2423d19b78ab71cb1ac8205406c7575296ecd3
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Fri Nov 2 13:29:24 2018 -0400

    Update address tests to avoid offending coverity.
---
 src/test/test_address.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/test/test_address.c b/src/test/test_address.c
index 69de072cf..a823fd9cd 100644
--- a/src/test/test_address.c
+++ b/src/test/test_address.c
@@ -1186,6 +1186,8 @@ helper_create_mock_node(char id_char)
 static void
 helper_free_mock_node(node_t *node)
 {
+  if (!node)
+    return;
   tor_free(node->ri);
   tor_free(node);
 }
@@ -1237,11 +1239,9 @@ test_address_tor_node_in_same_network_family(void *ignored)
   NODE_SET_IPV6(node_a, "2606:4700:4700::1001", 1);
   tt_int_op(nodes_in_same_family(node_a, node_b), OP_EQ, 1);
 
+ done:
   helper_free_mock_node(node_a);
   helper_free_mock_node(node_b);
-
- done:
-  return;
 }
 
 #define ADDRESS_TEST(name, flags) \
@@ -1279,4 +1279,3 @@ struct testcase_t address_tests[] = {
   ADDRESS_TEST(tor_node_in_same_network_family, 0),
   END_OF_TESTCASES
 };
-

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