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

[tor-commits] [tor/master] Fix a subtle memory leak in test_exorport.c



commit 37ea6cd9eb9bc4b6c0eb4f5d9cf70b97ea43eba4
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Tue Jan 26 16:58:27 2021 -0500

    Fix a subtle memory leak in test_exorport.c
    
    This is a _subtle_ bug introduced by d1494d14, which resolved
    connections that was allocated in the extorport/handshake test.  So
    how did the connection get freed?  Our test was set up so that every
    extorport connection would get the same ext_or_id.  Two connections
    couldn't have the same ext_or_id, and if they did, one would get
    freed.  This meant that the _next_ connection to be constructed in
    the test would cause the previous connection to become closeable,
    even if it hadn't been closeable before.
    
    But when we applied d149d14, we stopped making it so our code
    enforced this uniqueness, and thereby make it so we _weren't_
    freeing this connection in the tests.
    
    Closes #40260; bug not in any released version of Tor.
---
 src/test/test_extorport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/test_extorport.c b/src/test/test_extorport.c
index fd260f06dc..89a1aa90b3 100644
--- a/src/test/test_extorport.c
+++ b/src/test/test_extorport.c
@@ -473,7 +473,7 @@ test_ext_or_handshake(void *arg)
   tt_int_op(handshake_start_called,OP_EQ,1);
   tt_int_op(TO_CONN(conn)->type, OP_EQ, CONN_TYPE_OR);
   tt_int_op(TO_CONN(conn)->state, OP_EQ, 0);
-  close_closeable_connections();
+  connection_free_(TO_CONN(conn));
   conn = NULL;
 
   /* Okay, this time let's succeed the handshake but fail the USERADDR

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