From 7d6e7fdd0343c32a09c926e7094d43f6653baa4f Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Sun, 27 Mar 2016 22:22:29 +0200 Subject: [PATCH 1/3] Remove redundant only in manpage --- doc/tor.1.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/tor.1.txt b/doc/tor.1.txt index 6808a801a2..ac21806379 100644 --- a/doc/tor.1.txt +++ b/doc/tor.1.txt @@ -30,7 +30,7 @@ Users bounce their TCP streams -- web traffic, ftp, ssh, etc. -- around the network, and recipients, observers, and even the relays themselves have difficulty tracking the source of the stream. -By default, **tor** will only act as a client only. To help the network +By default, **tor** will act as a client only. To help the network by providing bandwidth as a relay, change the **ORPort** configuration option -- see below. Please also consult the documentation on the Tor Project's website. From addd18172167e549b28efc8cf1132e1b8f9d3972 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 28 Mar 2016 10:37:22 -0400 Subject: [PATCH 2/3] Fix memory leak in TestingEnableCellStatsEvent Only when we were actually flushing the cell stats to a controller would we free them. Thus, they could stay in RAM even after the circuit was freed (eg if we didn't have any controllers). Fixes bug 18673; bugfix on 0.2.5.1-alpha. --- changes/bug18673 | 4 ++++ src/or/circuitlist.c | 14 ++++++++++++++ src/or/circuitlist.h | 2 ++ src/or/control.c | 6 ++---- 4 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 changes/bug18673 diff --git a/changes/bug18673 b/changes/bug18673 new file mode 100644 index 0000000000..5d6161718a --- /dev/null +++ b/changes/bug18673 @@ -0,0 +1,4 @@ + o Minor bugfixes (memory leak): + - Fix a small memory leak that would occur when the + TestingEnableCellStatsEvent option was turned on. Fixes bug 18673; + bugfix on 0.2.5.2-alpha. diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index d6532ddc5f..670c5b3c19 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -756,6 +756,18 @@ or_circuit_new(circid_t p_circ_id, channel_t *p_chan) return circ; } +/** Free all storage held in circ->testing_cell_stats */ +void +circuit_clear_testing_cell_stats(circuit_t *circ) +{ + if (!circ) + return; + SMARTLIST_FOREACH(circ->testing_cell_stats, testing_cell_stats_entry_t *, + ent, tor_free(ent)); + smartlist_free(circ->testing_cell_stats); + circ->testing_cell_stats = NULL; +} + /** Deallocate space associated with circ. */ STATIC void @@ -767,6 +779,8 @@ circuit_free(circuit_t *circ) if (!circ) return; + circuit_clear_testing_cell_stats(circ); + if (CIRCUIT_IS_ORIGIN(circ)) { origin_circuit_t *ocirc = TO_ORIGIN_CIRCUIT(circ); mem = ocirc; diff --git a/src/or/circuitlist.h b/src/or/circuitlist.h index e4f1f47ce6..2707b426ab 100644 --- a/src/or/circuitlist.h +++ b/src/or/circuitlist.h @@ -71,6 +71,8 @@ void assert_circuit_ok(const circuit_t *c); void circuit_free_all(void); void circuits_handle_oom(size_t current_allocation); +void circuit_clear_testing_cell_stats(circuit_t *circ); + void channel_note_destroy_pending(channel_t *chan, circid_t id); MOCK_DECL(void, channel_note_destroy_not_pending, (channel_t *chan, circid_t id)); diff --git a/src/or/control.c b/src/or/control.c index 2bec8f9317..655b4dd335 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -4971,7 +4971,7 @@ sum_up_cell_stats_by_command(circuit_t *circ, cell_stats_t *cell_stats) { memset(cell_stats, 0, sizeof(cell_stats_t)); SMARTLIST_FOREACH_BEGIN(circ->testing_cell_stats, - testing_cell_stats_entry_t *, ent) { + const testing_cell_stats_entry_t *, ent) { tor_assert(ent->command <= CELL_COMMAND_MAX_); if (!ent->removed && !ent->exitward) { cell_stats->added_cells_appward[ent->command] += 1; @@ -4984,10 +4984,8 @@ sum_up_cell_stats_by_command(circuit_t *circ, cell_stats_t *cell_stats) cell_stats->removed_cells_exitward[ent->command] += 1; cell_stats->total_time_exitward[ent->command] += ent->waiting_time * 10; } - tor_free(ent); } SMARTLIST_FOREACH_END(ent); - smartlist_free(circ->testing_cell_stats); - circ->testing_cell_stats = NULL; + circuit_clear_testing_cell_stats(circ); } /** Helper: append a cell statistics string to event_parts, From c8eb39d67f4ea5f913998ea4aae2d3ba3f3c8258 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 28 Mar 2016 16:11:25 -0400 Subject: [PATCH 3/3] Remove a couple of redundant lines from the makefile Fixes the last case of 17744. --- changes/bug17744_redux | 5 +++++ configure.ac | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 changes/bug17744_redux diff --git a/changes/bug17744_redux b/changes/bug17744_redux new file mode 100644 index 0000000000..d61e17fec3 --- /dev/null +++ b/changes/bug17744_redux @@ -0,0 +1,5 @@ + o Minor bugfixes (build): + - Remove a pair of redundant AM_CONDITIONAL declarations from + configure.ac. Fixes one final case of bug 17744; bugfix on + 0.2.8.2-alpha. + diff --git a/configure.ac b/configure.ac index ad71f7fdda..e4816fdbd7 100644 --- a/configure.ac +++ b/configure.ac @@ -58,8 +58,6 @@ fi AM_CONDITIONAL(UNITTESTS_ENABLED, test "x$enable_unittests" != "xno") AM_CONDITIONAL(COVERAGE_ENABLED, test "x$enable_coverage" = "xyes") -AM_CONDITIONAL(UNITTESTS_ENABLED, test x$enable_unittests != xno) -AM_CONDITIONAL(COVERAGE_ENABLED, test x$enable_coverage = xyes) AM_CONDITIONAL(DISABLE_ASSERTS_IN_UNIT_TESTS, test "x$enable_asserts_in_tests" = "xno") if test "$enable_static_tor" = "yes"; then