[tor-commits] [tor/master] Fix an unreached null-pointer deref in connection tests

nickm at torproject.org nickm at torproject.org
Fri Dec 18 15:36:04 UTC 2015


commit 4ede2decadca1decb5f6755c6d65a459d4d09c95
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Dec 18 10:35:25 2015 -0500

    Fix an unreached null-pointer deref in connection tests
    
    This is CID 1343603
---
 src/test/test_connection.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/test/test_connection.c b/src/test/test_connection.c
index dab6f2b..c5ef929 100644
--- a/src/test/test_connection.c
+++ b/src/test/test_connection.c
@@ -182,14 +182,13 @@ test_conn_get_basic_teardown(const struct testcase_t *tc, void *arg)
       conn->linked_conn->write_event = NULL;
     }
 
-    connection_free(conn->linked_conn);
-    conn->linked_conn = NULL;
-
-    conn->linked_conn->linked_conn = NULL;
     if (!conn->linked_conn->marked_for_close) {
       connection_close_immediate(conn->linked_conn);
       connection_mark_for_close(conn->linked_conn);
     }
+    conn->linked_conn->linked_conn = NULL;
+    connection_free(conn->linked_conn);
+    conn->linked_conn = NULL;
   }
 
   /* We didn't set the events up properly, so we can't use event_del() in



More information about the tor-commits mailing list