commit 37ea6cd9eb9bc4b6c0eb4f5d9cf70b97ea43eba4
parent 930a17f347d834e928e6f4bd89803d676e233454
Author: Nick Mathewson <nickm@torproject.org>
Date: Tue, 26 Jan 2021 16:58:27 -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.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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