diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-04-26 00:11:17 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-04-26 00:11:17 -0400 |
commit | 1cf02605d4819f200ac70df6ea6c75cfd1ef14e5 (patch) | |
tree | b9f6fea322b49d78a8a35f867821d17fe602c82e /src/test/test.c | |
parent | c7951731ed1bcc06d1eb404bd699cc0e0392e626 (diff) | |
download | tor-1cf02605d4819f200ac70df6ea6c75cfd1ef14e5.tar.gz tor-1cf02605d4819f200ac70df6ea6c75cfd1ef14e5.zip |
Fix memory leak in test_onion_queues
Diffstat (limited to 'src/test/test.c')
-rw-r--r-- | src/test/test.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/test/test.c b/src/test/test.c index f1486e94c7..9bceab5c05 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -418,9 +418,10 @@ test_onion_queues(void) or_circuit_t *circ1 = or_circuit_new(0, NULL); or_circuit_t *circ2 = or_circuit_new(0, NULL); - create_cell_t *onionskin = NULL; + create_cell_t *onionskin = NULL, *create2_ptr; create_cell_t *create1 = tor_malloc_zero(sizeof(create_cell_t)); create_cell_t *create2 = tor_malloc_zero(sizeof(create_cell_t)); + create2_ptr = create2; /* remember, but do not free */ create_cell_init(create1, CELL_CREATE, ONION_HANDSHAKE_TYPE_TAP, TAP_ONIONSKIN_CHALLENGE_LEN, buf1); @@ -440,6 +441,7 @@ test_onion_queues(void) test_eq_ptr(circ2, onion_next_task(&onionskin)); test_eq(1, onion_num_pending(ONION_HANDSHAKE_TYPE_TAP)); test_eq(0, onion_num_pending(ONION_HANDSHAKE_TYPE_NTOR)); + tt_ptr_op(onionskin, ==, create2_ptr); clear_pending_onions(); test_eq(0, onion_num_pending(ONION_HANDSHAKE_TYPE_TAP)); @@ -450,6 +452,7 @@ test_onion_queues(void) circuit_free(TO_CIRCUIT(circ2)); tor_free(create1); tor_free(create2); + tor_free(onionskin); } static void |