summaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-03-28 10:37:22 -0400
committerNick Mathewson <nickm@torproject.org>2016-03-28 11:12:15 -0400
commitaddd18172167e549b28efc8cf1132e1b8f9d3972 (patch)
tree6b910ec4c71be4c4114a16a46249c861ee97c148 /src/or/control.c
parent65db5ae566d463dd682a2f63ddf448d04101dab6 (diff)
downloadtor-addd18172167e549b28efc8cf1132e1b8f9d3972.tar.gz
tor-addd18172167e549b28efc8cf1132e1b8f9d3972.zip
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.
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c6
1 files changed, 2 insertions, 4 deletions
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 <code>event_parts</code>,